30 lines
655 B
C++
30 lines
655 B
C++
#ifndef LCD_I2C_H
|
|
#define LCD_I2C_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#define LCD_ADDRESS 0x27
|
|
|
|
class LiquidCrystal_I2C {
|
|
public:
|
|
LiquidCrystal_I2C(uint8_t address, uint8_t cols, uint8_t rows);
|
|
void begin(uint8_t cols, uint8_t rows);
|
|
void clear();
|
|
void home();
|
|
void setCursor(uint8_t col, uint8_t row);
|
|
void print(const char* str);
|
|
void print(char c);
|
|
void command(uint8_t value);
|
|
|
|
private:
|
|
void send(uint8_t value, uint8_t mode);
|
|
void write4bits(uint8_t value, uint8_t mode);
|
|
void write8bits(uint8_t value, uint8_t mode);
|
|
void pulseEnable(uint8_t value);
|
|
|
|
uint8_t _address;
|
|
uint8_t _backlight;
|
|
};
|
|
|
|
#endif
|