FEATURE: Simple but almost full featured HD4478U LCD Driver over I2C with PCF8574A
This commit is contained in:
parent
c9c165cf7c
commit
a0110696ae
@ -15,18 +15,26 @@ namespace floatpump{
|
|||||||
LCD_I2C_Driver(I2C_HandleTypeDef &handle, uint16_t displayAddr, uint8_t rows = 4, uint8_t cols = 20)
|
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) {};
|
: m_handle(handle), m_displayAddr(displayAddr), m_rows(rows), m_cols(cols) {};
|
||||||
|
|
||||||
|
// Functions sending text
|
||||||
void LCDSendCString(char *str);
|
void LCDSendCString(char *str);
|
||||||
|
|
||||||
|
// Functions for configuration
|
||||||
void LCDInitialize(void);
|
void LCDInitialize(void);
|
||||||
void LCDClearDisplay(void);
|
void LCDClearDisplay(void);
|
||||||
void LCDSetBacklight(bool enabled);
|
void LCDSetBacklight(bool enabled);
|
||||||
void LCDPower(bool enabled);
|
void LCDPower(bool enabled);
|
||||||
void LCDCursor(bool enabled);
|
void LCDCursor(bool enabled);
|
||||||
void LCDCursorBlink(bool enabled);
|
void LCDCursorBlink(bool enabled);
|
||||||
|
|
||||||
|
// These configurations are normally not necessary to change
|
||||||
void LCDCursorIncDec(bool enabled);
|
void LCDCursorIncDec(bool enabled);
|
||||||
void LCDDisplayShift(bool enabled);
|
void LCDDisplayShift(bool enabled);
|
||||||
|
|
||||||
|
// Move Cursor
|
||||||
void LCDSetCursor(uint8_t x, uint8_t y);
|
void LCDSetCursor(uint8_t x, uint8_t y);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
I2C_HandleTypeDef m_handle;
|
I2C_HandleTypeDef m_handle;
|
||||||
uint16_t m_displayAddr;
|
uint16_t m_displayAddr;
|
||||||
@ -38,8 +46,7 @@ namespace floatpump{
|
|||||||
bool m_autoShift{};
|
bool m_autoShift{};
|
||||||
bool m_powered;
|
bool m_powered;
|
||||||
|
|
||||||
uint8_t m_rows;
|
uint8_t m_posx, m_posy;
|
||||||
uint8_t m_cols;
|
|
||||||
|
|
||||||
void m_lcdSendData(char data);
|
void m_lcdSendData(char data);
|
||||||
void m_lcdSendCmnd(char cmnd);
|
void m_lcdSendCmnd(char cmnd);
|
||||||
|
@ -76,6 +76,9 @@ namespace floatpump {
|
|||||||
|
|
||||||
m_incrementDecrement = true;
|
m_incrementDecrement = true;
|
||||||
m_autoShift = false;
|
m_autoShift = false;
|
||||||
|
|
||||||
|
m_posx = 0;
|
||||||
|
m_posy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LCD_I2C_Driver::LCDSendCString(char *str) {
|
void LCD_I2C_Driver::LCDSendCString(char *str) {
|
||||||
@ -144,6 +147,9 @@ namespace floatpump {
|
|||||||
addr = startat + x;
|
addr = startat + x;
|
||||||
m_lcdSendCmnd(( 0x80 | addr));
|
m_lcdSendCmnd(( 0x80 | addr));
|
||||||
HAL_Delay(1);
|
HAL_Delay(1);
|
||||||
|
|
||||||
|
m_posx = x;
|
||||||
|
m_posy = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // floatpump
|
} // floatpump
|
Loading…
Reference in New Issue
Block a user