More on LCD

This commit is contained in:
Martin Brodbeck 2022-05-30 21:36:56 +02:00
parent 0a48d09436
commit a52c1b94b8
2 changed files with 3 additions and 4 deletions

View file

@ -7,15 +7,14 @@
constexpr uint I2C_SDA_PIN = 26; constexpr uint I2C_SDA_PIN = 26;
constexpr uint I2C_SCL_PIN = 27; constexpr uint I2C_SCL_PIN = 27;
constexpr uint8_t I2C_ADDR = 0x27;
int main() { int main() {
// Enable UART so we can print status output // Enable UART so we can print status output
stdio_init_all(); stdio_init_all();
auto myLCD = LCD(i2c1, I2C_SDA_PIN, I2C_SCL_PIN, I2C_ADDR); auto myLCD = LCD(i2c1, I2C_SDA_PIN, I2C_SCL_PIN);
myLCD.sendString("Hallo, Welt"); myLCD.sendString("Hallo, Welt");
myLCD.clear(); myLCD.clear();
myLCD.sendString("le"); myLCD.sendString("Hallo, Wölt!");
} }

2
lcd.h
View file

@ -16,7 +16,7 @@ class LCD
{ {
public: public:
LCD(i2c_inst_t *i2c, const uint gpio_sda, const uint gpio_scl, LCD(i2c_inst_t *i2c, const uint gpio_sda, const uint gpio_scl,
const uint8_t i2c_addr, uint8_t num_cols = 16, uint8_t num_lines = 2); const uint8_t i2c_addr = 0x27, uint8_t num_cols = 16, uint8_t num_lines = 2);
int backlight_off(); int backlight_off();
int backlight_on(); int backlight_on();
void sendString(const std::string &str); void sendString(const std::string &str);