90 #include "em_device.h" 102 #define DISPLAY_ADDRESS 0x72 105 #define SPECIAL_COMMAND 254 106 #define SETTING_COMMAND 0x7C 109 #define CLEAR_COMMAND 0x2D //45, -, the dash character: command to clear and home the display 110 #define CONTRAST_COMMAND 0x18 //Command to change the contrast setting 111 #define ADDRESS_COMMAND 0x19 //Command to change the i2c address 112 #define SET_RGB_COMMAND 0x2B //43, +, the plus character: command to set backlight RGB value 113 #define ENABLE_SYSTEM_MESSAGE_DISPLAY 0x2E //46, ., command to enable system messages being displayed 114 #define DISABLE_SYSTEM_MESSAGE_DISPLAY 0x2F //47, /, command to disable system messages being displayed 115 #define ENABLE_SPLASH_DISPLAY 0x30 //48, 0, command to enable splash screen at power on 116 #define DISABLE_SPLASH_DISPLAY 0x31 //49, 1, command to disable splash screen at power on 117 #define SAVE_CURRENT_DISPLAY_AS_SPLASH 0x0A //10, Ctrl+j, command to save current text on display as splash 120 #define LCD_RETURNHOME 0x02 121 #define LCD_ENTRYMODESET 0x04 122 #define LCD_DISPLAYCONTROL 0x08 123 #define LCD_CURSORSHIFT 0x10 124 #define LCD_SETDDRAMADDR 0x80 127 #define LCD_ENTRYRIGHT 0x00 128 #define LCD_ENTRYLEFT 0x02 129 #define LCD_ENTRYSHIFTINCREMENT 0x01 130 #define LCD_ENTRYSHIFTDECREMENT 0x00 133 #define LCD_DISPLAYON 0x04 134 #define LCD_DISPLAYOFF 0x00 135 #define LCD_CURSORON 0x02 136 #define LCD_CURSOROFF 0x00 137 #define LCD_BLINKON 0x01 138 #define LCD_BLINKOFF 0x00 141 #define LCD_DISPLAYMOVE 0x08 142 #define LCD_CURSORMOVE 0x00 143 #define LCD_MOVERIGHT 0x04 144 #define LCD_MOVELEFT 0x00 171 if (
initI2C() != 0)
return (-6);
177 I2C_TransferSeq_TypeDef i2cTransfer;
178 I2C_TransferReturn_TypeDef result;
182 i2cTransfer.flags = I2C_FLAG_WRITE;
183 i2cTransfer.buf[0].data = data_buf;
184 i2cTransfer.buf[0].len = 2;
185 result = I2C_TransferInit(
BUS_I2C, &i2cTransfer);
188 while (result == i2cTransferInProgress) result = I2C_Transfer(
BUS_I2C);
217 if (
initI2C() != 0)
return (-6);
223 I2C_TransferSeq_TypeDef i2cTransfer;
224 I2C_TransferReturn_TypeDef result;
228 i2cTransfer.flags = I2C_FLAG_WRITE;
229 i2cTransfer.buf[0].data = data_buf;
230 i2cTransfer.buf[0].len = 1;
231 result = I2C_TransferInit(
BUS_I2C, &i2cTransfer);
234 while (result == i2cTransferInProgress) result = I2C_Transfer(
BUS_I2C);
267 if (
initI2C() != 0)
return (-6);
273 while (message[length] !=
'\0') length++;
276 I2C_TransferSeq_TypeDef i2cTransfer;
277 I2C_TransferReturn_TypeDef result;
281 i2cTransfer.flags = I2C_FLAG_WRITE;
282 i2cTransfer.buf[0].data = (
unsigned char *)message;
283 i2cTransfer.buf[0].len = length;
284 result = I2C_TransferInit(
BUS_I2C, &i2cTransfer);
287 while (result == i2cTransferInProgress) result = I2C_Transfer(
BUS_I2C);
318 uint8_t row_offsets[] = {0x00, 0x40, 0x14, 0x54};
321 if (
initI2C() != 0)
return (-6);
327 I2C_TransferSeq_TypeDef i2cTransfer;
328 I2C_TransferReturn_TypeDef result;
332 i2cTransfer.flags = I2C_FLAG_WRITE;
333 i2cTransfer.buf[0].data = data_buf;
334 i2cTransfer.buf[0].len = 2;
335 result = I2C_TransferInit(
BUS_I2C, &i2cTransfer);
338 while (result == i2cTransferInProgress) result = I2C_Transfer(
BUS_I2C);
364 if (
initI2C() != 0)
return (-6);
371 else data_buf[2] =
'*';
375 I2C_TransferSeq_TypeDef i2cTransfer;
376 I2C_TransferReturn_TypeDef result;
380 i2cTransfer.flags = I2C_FLAG_WRITE;
381 i2cTransfer.buf[0].data = data_buf;
382 i2cTransfer.buf[0].len = 3;
383 result = I2C_TransferInit(
BUS_I2C, &i2cTransfer);
386 while (result == i2cTransferInProgress) result = I2C_Transfer(
BUS_I2C);
int8_t writeStringLCD(char *message)
Print a string (char array) to the LCD.
signed char int8_t
Typedef defining 8 bit char type. The developer should modify this to suit the platform being deploye...
int8_t clearLCD(void)
Clear the LCD.
int8_t writeCharLCD(uint8_t data)
Write a character (one byte) to the LCD.
The pin definitions for the custom board.
Enable or disable printing to UART with dbprint.
int8_t heartBeatLCD(void)
Update the heartbeat icon.
int8_t initI2C(void)
I2C initialization (if not already initialized).
int8_t setCursorLCD(uint8_t col, uint8_t row)
Set the cursor to a specific location on the LCD.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type. The developer should modify this to suit the platform bein...