diff --git a/source/shoh/src/main.cpp b/source/shoh/src/main.cpp index 0b1f6bc..d374f52 100644 --- a/source/shoh/src/main.cpp +++ b/source/shoh/src/main.cpp @@ -7,6 +7,9 @@ #include "Master.h" #include "Rotary.h" #include "retarget_uart.h" +#include "LiquidCrystal.h" + +void lcd_starting(); int main(void) { @@ -16,6 +19,8 @@ int main(void) retarget_init(); printf("Hello there!\r\n"); + + lcd_starting(); ThreadCommon::ThreadManager* manager = new ThreadCommon::ThreadManager; ThreadCommon::QueueManager* qmanager = new ThreadCommon::QueueManager; @@ -36,3 +41,44 @@ int main(void) return 1; } + +/** + * @brief While we don't have UI, this should do for LCD. + * + */ +void lcd_starting() { + // LCD pins init. + //Well, this lpc is a bit different with those. Table 83 from UM10732-11u68.pdf + DigitalIoPin *rs = new DigitalIoPin(1, 9, false); + Chip_IOCON_PinMuxSet (LPC_IOCON, 1, 9, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); + + DigitalIoPin *en = new DigitalIoPin(0, 14, false); + Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 14, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); + + DigitalIoPin *d4 = new DigitalIoPin(0, 13, false); + Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 13, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); + + DigitalIoPin *d5 = new DigitalIoPin(0, 12, false); + Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 12, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); + + DigitalIoPin *d6 = new DigitalIoPin(0, 23, false); + Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 23, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); + + DigitalIoPin *d7 = new DigitalIoPin(0, 11, false); + Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 11, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); + + rs->write(false); + en->write(false); + d4->write(false); + d5->write(false); + d6->write(false); + d7->write(false); + // LCD init. + LiquidCrystal *lcd = new LiquidCrystal(rs, en, d4, d5, d6, d7); + // LCD configure display geometry. + lcd->begin(16, 2); + lcd->setCursor (0, 0); + lcd->print("Hello there"); + lcd->setCursor (0, 1); + lcd->print("Starting..."); +}