diff --git a/SwitchController/.cproject b/SwitchController/.cproject new file mode 100644 index 0000000..7a489da --- /dev/null +++ b/SwitchController/.cproject @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <?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/SwitchController/.gitignore b/SwitchController/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/SwitchController/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/SwitchController/.project b/SwitchController/.project new file mode 100644 index 0000000..18427c4 --- /dev/null +++ b/SwitchController/.project @@ -0,0 +1,32 @@ + + + SwitchController + + + lpc_chip_15xx + DigitalIoPin + Timer + StateHandler + LiquidCrystal + + + + 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/SwitchController/inc/SwitchController.h b/SwitchController/inc/SwitchController.h new file mode 100644 index 0000000..cdede07 --- /dev/null +++ b/SwitchController/inc/SwitchController.h @@ -0,0 +1,33 @@ +/* + * SwitchController.h + * + * Created on: Oct 17, 2022 + * Author: tylen + */ + +#ifndef SWITCHCONTROLLER_H_ +#define SWITCHCONTROLLER_H_ + +#include "DigitalIoPin.h" +#include "StateHandler.h" +#include "Timer.h" + +class SwitchController +{ +public: + SwitchController (DigitalIoPin *button, Timer *timer, StateHandler *handler, + int button_mode); + virtual ~SwitchController (); + /** Listen to switch button + */ + void listen (); + +private: + DigitalIoPin *b; + Timer *t; + StateHandler *h; + bool b_state; + int b_mode; +}; + +#endif /* SWITCHCONTROLLER_H_ */ diff --git a/SwitchController/liblinks.xml b/SwitchController/liblinks.xml new file mode 100644 index 0000000..1dc1803 --- /dev/null +++ b/SwitchController/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/SwitchController/src/SwitchController.cpp b/SwitchController/src/SwitchController.cpp new file mode 100644 index 0000000..53fac52 --- /dev/null +++ b/SwitchController/src/SwitchController.cpp @@ -0,0 +1,37 @@ +/* + * SwitchController.cpp + * + * Created on: Oct 17, 2022 + * Author: tylen + */ + +#include + +SwitchController::SwitchController (DigitalIoPin *button, Timer *timer, + StateHandler *handler, int button_mode) +{ + b = button; + t = timer; + h = handler; + b_state = false; + b_mode = button_mode; +} + +SwitchController::~SwitchController () +{ + // TODO Auto-generated destructor stub +} + +void +SwitchController::listen () +{ + if (b->read ()) + { + b_state = true; + } + if (!b->read () && b_state) + { + h->HandleState (Event (Event::eKey, b_mode)); + b_state = false; + } +} \ No newline at end of file diff --git a/esp-vent-main/.cproject b/esp-vent-main/.cproject index 521b9f6..534fcb6 100644 --- a/esp-vent-main/.cproject +++ b/esp-vent-main/.cproject @@ -46,6 +46,7 @@ + @@ -126,6 +129,7 @@ + @@ -280,6 +288,7 @@ +