make mode invisible

This commit is contained in:
Martin Brodbeck 2022-05-31 15:25:59 +02:00
parent d6d91f4cb2
commit ba95eeebb9

View file

@ -6,29 +6,28 @@
#include "hardware/i2c.h" #include "hardware/i2c.h"
#include "pico/stdlib.h" #include "pico/stdlib.h"
enum class Mode { COMMAND, CHARACTER };
class LCD { 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 = 0x27, uint8_t num_cols = 16, const uint8_t i2c_addr = 0x27, uint8_t num_cols = 16,
uint8_t num_lines = 2); uint8_t num_lines = 2);
void sendString(const std::string &str); void sendString(const std::string &str);
void setCursor(int line, int position); void setCursor(int line, int position);
void clear(); void clear();
private: private:
void sendByte(uint8_t val, Mode mode); enum class Mode { COMMAND, CHARACTER };
void toggleEnable(uint8_t val); void sendByte(uint8_t val, Mode mode);
void i2cWriteByte(uint8_t val); void toggleEnable(uint8_t val);
void sendChar(char val); void i2cWriteByte(uint8_t val);
i2c_inst_t *i2c; void sendChar(char val);
uint8_t i2c_addr; i2c_inst_t *i2c;
uint8_t num_cols; uint8_t i2c_addr;
uint8_t num_lines; uint8_t num_cols;
uint8_t cursor_x{0}; uint8_t num_lines;
uint8_t cursor_y{0}; uint8_t cursor_x{0};
uint8_t cursor_y{0};
}; };
#endif #endif