CHANGE: added struct storing current position

This commit is contained in:
Robin Dietzel 2022-12-09 15:59:27 +01:00
parent dd7fca18ec
commit ece7ecf905
2 changed files with 10 additions and 5 deletions

View File

@ -33,7 +33,14 @@ namespace floatpump{
// Move Cursor
void LCDSetCursor(uint8_t x, uint8_t y);
// Position
typedef struct {
uint8_t x;
uint8_t y;
} pos_t;
// Getters
pos_t getPosition();
private:
I2C_HandleTypeDef m_handle;
@ -46,7 +53,7 @@ namespace floatpump{
bool m_autoShift{};
bool m_powered;
uint8_t m_posx, m_posy;
pos_t m_curPos;
void m_lcdSendData(char data);
void m_lcdSendCmnd(char cmnd);

View File

@ -77,8 +77,7 @@ namespace floatpump {
m_incrementDecrement = true;
m_autoShift = false;
m_posx = 0;
m_posy = 0;
m_curPos = {0, 0};
}
void LCD_I2C_Driver::LCDSendCString(char *str) {
@ -148,8 +147,7 @@ namespace floatpump {
m_lcdSendCmnd(( 0x80 | addr));
HAL_Delay(1);
m_posx = x;
m_posy = y;
m_curPos = {x, y};
}
} // floatpump