FEATURE: Simple but almost full featured HD4478U LCD Driver over I2C with PCF8574A

This commit is contained in:
Robin Dietzel 2022-12-09 15:47:07 +01:00
parent c9c165cf7c
commit a0110696ae
2 changed files with 15 additions and 2 deletions

View File

@ -15,18 +15,26 @@ namespace floatpump{
LCD_I2C_Driver(I2C_HandleTypeDef &handle, uint16_t displayAddr, uint8_t rows = 4, uint8_t cols = 20)
: m_handle(handle), m_displayAddr(displayAddr), m_rows(rows), m_cols(cols) {};
// Functions sending text
void LCDSendCString(char *str);
// Functions for configuration
void LCDInitialize(void);
void LCDClearDisplay(void);
void LCDSetBacklight(bool enabled);
void LCDPower(bool enabled);
void LCDCursor(bool enabled);
void LCDCursorBlink(bool enabled);
// These configurations are normally not necessary to change
void LCDCursorIncDec(bool enabled);
void LCDDisplayShift(bool enabled);
// Move Cursor
void LCDSetCursor(uint8_t x, uint8_t y);
private:
I2C_HandleTypeDef m_handle;
uint16_t m_displayAddr;
@ -38,8 +46,7 @@ namespace floatpump{
bool m_autoShift{};
bool m_powered;
uint8_t m_rows;
uint8_t m_cols;
uint8_t m_posx, m_posy;
void m_lcdSendData(char data);
void m_lcdSendCmnd(char cmnd);

View File

@ -76,6 +76,9 @@ namespace floatpump {
m_incrementDecrement = true;
m_autoShift = false;
m_posx = 0;
m_posy = 0;
}
void LCD_I2C_Driver::LCDSendCString(char *str) {
@ -144,6 +147,9 @@ namespace floatpump {
addr = startat + x;
m_lcdSendCmnd(( 0x80 | addr));
HAL_Delay(1);
m_posx = x;
m_posy = y;
}
} // floatpump