diff --git a/DigitalIoPin/.cproject b/DigitalIoPin/.cproject
new file mode 100644
index 0000000..8285142
--- /dev/null
+++ b/DigitalIoPin/.cproject
@@ -0,0 +1,250 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="100300"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+</info>
+</infoList>
+</TargetConfig>
+
+
+
+ LPCXpresso1549
+
+
+
\ No newline at end of file
diff --git a/DigitalIoPin/.gitignore b/DigitalIoPin/.gitignore
new file mode 100644
index 0000000..3df573f
--- /dev/null
+++ b/DigitalIoPin/.gitignore
@@ -0,0 +1 @@
+/Debug/
diff --git a/DigitalIoPin/.project b/DigitalIoPin/.project
new file mode 100644
index 0000000..b55f3c5
--- /dev/null
+++ b/DigitalIoPin/.project
@@ -0,0 +1,29 @@
+
+
+ DigitalIoPin
+
+
+ lpc_chip_15xx
+ DigitalIoPin
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
diff --git a/DigitalIoPin/.settings/language.settings.xml b/DigitalIoPin/.settings/language.settings.xml
new file mode 100644
index 0000000..1a41d3e
--- /dev/null
+++ b/DigitalIoPin/.settings/language.settings.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DigitalIoPin/inc/DigitalIoPin.h b/DigitalIoPin/inc/DigitalIoPin.h
new file mode 100644
index 0000000..de004af
--- /dev/null
+++ b/DigitalIoPin/inc/DigitalIoPin.h
@@ -0,0 +1,43 @@
+/*
+ * DigitalIoPin.h
+ *
+ * Created on: Aug 29, 2022
+ * Author: Vasily Davydov
+ */
+
+#ifndef DIGITALIOPIN_H_
+#define DIGITALIOPIN_H_
+
+#define UINT8_MAX_VALUE 255
+
+#include
+#include
+
+typedef struct DigitalIOConfigStruct
+{
+ uint8_t _port;
+ uint8_t _pin;
+ bool _input;
+ bool _pullup;
+ bool _invert;
+ uint32_t IOCON_mode;
+ uint32_t IOCON_inv;
+ uint32_t DigitalEn;
+} DigitalIOConfigStruct;
+
+class DigitalIoPin
+{
+public:
+ DigitalIoPin (int port, int pin, bool input = true, bool pullup = true,
+ bool invert = false);
+ DigitalIoPin (const DigitalIoPin &) = delete;
+ virtual ~DigitalIoPin ();
+ bool read ();
+ void write (bool value);
+
+private:
+ DigitalIOConfigStruct _io = { 0, 0, false, false, false, 0, 0, IOCON_DIGMODE_EN};
+ void setIoPin ();
+};
+
+#endif /* DIGITALIOPIN_H_ */
diff --git a/DigitalIoPin/liblinks.xml b/DigitalIoPin/liblinks.xml
new file mode 100644
index 0000000..1dc1803
--- /dev/null
+++ b/DigitalIoPin/liblinks.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ ${MacroStart}workspace_loc:/${ProjName}/inc${MacroEnd}
+
+
+ ${MacroStart}workspace_loc:/${ProjName}/inc${MacroEnd}
+
+
+ ${ProjName}
+
+
+ ${MacroStart}workspace_loc:/${ProjName}/Debug${MacroEnd}
+
+
+ ${MacroStart}workspace_loc:/${ProjName}/Release${MacroEnd}
+
+
+ ${ProjName}
+
+
+
diff --git a/DigitalIoPin/src/DigitalIoPin.cpp b/DigitalIoPin/src/DigitalIoPin.cpp
new file mode 100644
index 0000000..13f7d87
--- /dev/null
+++ b/DigitalIoPin/src/DigitalIoPin.cpp
@@ -0,0 +1,64 @@
+/*
+ * DigitalIoPin.cpp
+ *
+ * Created on: Aug 29, 2022
+ * Author: Vasily Davydov
+ */
+
+#include "DigitalIoPin.h"
+
+DigitalIoPin::DigitalIoPin (int port, int pin, bool input, bool pullup,
+ bool invert)
+{
+ assert ((port <= UINT8_MAX_VALUE) && (pin <= UINT8_MAX_VALUE));
+ _io._port = (uint8_t)port;
+ _io._pin = (uint8_t)pin;
+ _io._input = input;
+ _io._pullup = pullup;
+ _io._invert = invert;
+ _io.IOCON_mode = IOCON_MODE_INACT;
+ _io.IOCON_inv = IOCON_FUNC0;
+ setIoPin ();
+}
+
+DigitalIoPin::~DigitalIoPin ()
+{
+}
+
+void
+DigitalIoPin::setIoPin ()
+{
+ bool direction = true;
+ if (_io._input)
+ {
+ direction = false;
+ _io.IOCON_mode = IOCON_MODE_PULLUP;
+ if (!_io._pullup)
+ {
+ _io.IOCON_mode = IOCON_MODE_PULLDOWN;
+ }
+ if (_io._invert)
+ {
+ _io.IOCON_inv = IOCON_INV_EN;
+ }
+ }
+ Chip_IOCON_PinMuxSet (LPC_IOCON, _io._port, _io._pin,
+ (_io.IOCON_mode | _io.DigitalEn | _io.IOCON_inv));
+ /** False direction equals input */
+ Chip_GPIO_SetPinDIR (LPC_GPIO, _io._port, _io._pin, direction);
+}
+
+bool
+DigitalIoPin::read ()
+{
+ bool state = (Chip_GPIO_GetPinState (LPC_GPIO, _io._port, _io._pin));
+ return (_io._invert && !_io._input) ? !state : state;
+}
+
+void
+DigitalIoPin::write (bool value)
+{
+ assert (!(_io._input));
+ Chip_GPIO_SetPinState (LPC_GPIO, _io._port, _io._pin, ((_io._invert) ? !value : value));
+}
+
diff --git a/esp-vent-main/.cproject b/esp-vent-main/.cproject
index f6d4886..fa1ef8e 100644
--- a/esp-vent-main/.cproject
+++ b/esp-vent-main/.cproject
@@ -37,12 +37,13 @@
-
-
+
@@ -61,12 +62,13 @@
-
-
+
@@ -75,10 +77,11 @@
-
@@ -103,21 +106,25 @@
-
-
-
+
-
+
+
+
@@ -164,12 +171,13 @@
-
-
+
@@ -188,12 +196,13 @@
-
-
+
@@ -202,10 +211,11 @@
-
@@ -230,15 +240,17 @@
-
-
-
+
@@ -295,4 +307,6 @@
LPCXpresso1549
+
+
\ No newline at end of file
diff --git a/esp-vent-main/.project b/esp-vent-main/.project
index 72a5944..1f60a8b 100644
--- a/esp-vent-main/.project
+++ b/esp-vent-main/.project
@@ -5,6 +5,7 @@
lpc_board_nxp_lpcxpresso_1549
lpc_chip_15xx
+ DigitalIoPin