44#define clockPolarity SerialDriver::SCK_HIGH
54#define clockPhase SerialDriver::LEAD_CHANGE
57#define SpiPort ConnectorCOM0
60const uint8_t line1[21] =
"abcdefghijklmnopqrst";
61const uint8_t line2[21] =
"ABCDEFGHIJKLMNOPQRST";
62const uint8_t line3[21] =
"01234567890123456789";
63const uint8_t line4[21] =
"98765432109876543210";
66void SetBrightness(uint8_t level);
67void SetCursor(uint8_t row, uint8_t column);
71 SpiPort.Mode(Connector::SPI);
72 SpiPort.Speed(baudRate);
73 SpiPort.DataOrder(SerialDriver::COM_MSB_FIRST);
74 SpiPort.SpiClock(clockPolarity, clockPhase);
88 SpiPort.SpiSsMode(SerialDriver::LINE_ON);
93 SpiPort.SpiTransferData(line1, NULL, 20);
94 SpiPort.SpiTransferData(line3, NULL, 20);
95 SpiPort.SpiTransferData(line2, NULL, 20);
96 SpiPort.SpiTransferData(line4, NULL, 20);
99 SpiPort.SpiSsMode(SerialDriver::LINE_OFF);
114void SetBrightness(uint8_t level) {
115 SpiPort.SpiSsMode(SerialDriver::LINE_ON);
116 SpiPort.SpiTransferData(0xfe);
117 SpiPort.SpiTransferData(0x53);
118 SpiPort.SpiTransferData(level);
119 SpiPort.SpiSsMode(SerialDriver::LINE_OFF);
136void SetCursor(uint8_t row, uint8_t column) {
138 if (row >= NUM_ROWS) {
141 if (column >= NUM_COLUMNS) {
145 uint8_t position = row * NUM_COLUMNS + column;
146 SpiPort.SpiSsMode(SerialDriver::LINE_ON);
147 SpiPort.SpiTransferData(0xfe);
148 SpiPort.SpiTransferData(0x45);
149 SpiPort.SpiTransferData(position);
150 SpiPort.SpiSsMode(SerialDriver::LINE_OFF);