31 lines
723 B
C++
31 lines
723 B
C++
#include "constants.h"
|
|
#include <LCD_I2C.h>
|
|
#include <Wire.h>
|
|
#include "characters.h"
|
|
|
|
LCD_I2C lcd(LCD_I2C_ADDR, LCD_COLS, LCD_ROWS);
|
|
|
|
bool setupScreen() {
|
|
lcd.begin();
|
|
|
|
Wire.beginTransmission(LCD_I2C_ADDR);
|
|
if (Wire.endTransmission() != 0) {
|
|
Serial.println("LCD not connected");
|
|
return false;
|
|
}
|
|
|
|
lcd.backlight();
|
|
lcd.clear();
|
|
|
|
// add custom characters to CGROM
|
|
// can only add 8 custom characters ,_,
|
|
lcd.createChar(CHAR_INVERTED_A, invertedA);
|
|
lcd.createChar(CHAR_INVERTED_B, invertedB);
|
|
lcd.createChar(CHAR_INVERTED_C, invertedC);
|
|
lcd.createChar(CHAR_INVERTED_D, invertedD);
|
|
lcd.createChar(CHAR_ENCODER, encoder);
|
|
lcd.createChar(CHAR_ENCODER_SWITCH, encoderSwitch);
|
|
|
|
return true;
|
|
}
|