mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-01 10:19:59 +00:00
Adafruit display (#3179)
* Use uint8_t instead of char in icon_bits * Add Adafruit PiTFT support
This commit is contained in:
parent
996e72a816
commit
3b0169ba7a
@ -91,7 +91,19 @@ Display:
|
|||||||
# OffsetX: 0
|
# OffsetX: 0
|
||||||
# OffsetY: 0
|
# OffsetY: 0
|
||||||
|
|
||||||
|
### Adafruit PiTFT 2.8 TFT+Touchscreen
|
||||||
|
# Panel: ILI9341
|
||||||
|
# CS: 8
|
||||||
|
# DC: 25
|
||||||
|
# Backlight: 2
|
||||||
|
# Width: 320
|
||||||
|
# Height: 240
|
||||||
|
|
||||||
Touchscreen:
|
Touchscreen:
|
||||||
|
# Module: STMPE610
|
||||||
|
# CS: 7
|
||||||
|
# IRQ: 24
|
||||||
|
|
||||||
# Module: XPT2046
|
# Module: XPT2046
|
||||||
# CS: 7
|
# CS: 7
|
||||||
# IRQ: 17
|
# IRQ: 17
|
||||||
|
@ -150,7 +150,7 @@ static void drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDispl
|
|||||||
|
|
||||||
// draw centered icon left to right and centered above the one line of app text
|
// draw centered icon left to right and centered above the one line of app text
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - icon_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - icon_height) / 2 + 2,
|
display->drawXbm(x + (SCREEN_WIDTH - icon_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - icon_height) / 2 + 2,
|
||||||
icon_width, icon_height, (const uint8_t *)icon_bits);
|
icon_width, icon_height, icon_bits);
|
||||||
|
|
||||||
display->setFont(FONT_MEDIUM);
|
display->setFont(FONT_MEDIUM);
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
|
@ -354,6 +354,8 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_panel_instance = new lgfx::Panel_ST7735;
|
_panel_instance = new lgfx::Panel_ST7735;
|
||||||
else if (settingsMap[displayPanel] == st7735s)
|
else if (settingsMap[displayPanel] == st7735s)
|
||||||
_panel_instance = new lgfx::Panel_ST7735S;
|
_panel_instance = new lgfx::Panel_ST7735S;
|
||||||
|
else if (settingsMap[displayPanel] == ili9341)
|
||||||
|
_panel_instance = new lgfx::Panel_ILI9341;
|
||||||
auto buscfg = _bus_instance.config();
|
auto buscfg = _bus_instance.config();
|
||||||
buscfg.spi_mode = 0;
|
buscfg.spi_mode = 0;
|
||||||
|
|
||||||
@ -379,6 +381,8 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
if (settingsMap[touchscreenModule]) {
|
if (settingsMap[touchscreenModule]) {
|
||||||
if (settingsMap[touchscreenModule] == xpt2046) {
|
if (settingsMap[touchscreenModule] == xpt2046) {
|
||||||
_touch_instance = new lgfx::Touch_XPT2046;
|
_touch_instance = new lgfx::Touch_XPT2046;
|
||||||
|
} else if (settingsMap[touchscreenModule] == stmpe610) {
|
||||||
|
_touch_instance = new lgfx::Touch_STMPE610;
|
||||||
}
|
}
|
||||||
auto touch_cfg = _touch_instance->config();
|
auto touch_cfg = _touch_instance->config();
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define icon_width 50
|
#define icon_width 50
|
||||||
#define icon_height 28
|
#define icon_height 28
|
||||||
static char icon_bits[] = {
|
static uint8_t icon_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03,
|
||||||
0x00, 0x00, 0x00, 0x80, 0x07, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x1F,
|
0x00, 0x00, 0x00, 0x80, 0x07, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x1F,
|
||||||
0xC0, 0x0F, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0xE0, 0x0F, 0x00, 0x00, 0x00,
|
0xC0, 0x0F, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0xE0, 0x0F, 0x00, 0x00, 0x00,
|
||||||
@ -17,4 +17,4 @@ static char icon_bits[] = {
|
|||||||
0xFE, 0x00, 0x00, 0xFC, 0x01, 0x7E, 0x00, 0x7F, 0x00, 0x00, 0xF8, 0x01,
|
0xFE, 0x00, 0x00, 0xFC, 0x01, 0x7E, 0x00, 0x7F, 0x00, 0x00, 0xF8, 0x01,
|
||||||
0x7E, 0x00, 0x3E, 0x00, 0x00, 0xF8, 0x01, 0x38, 0x00, 0x3C, 0x00, 0x00,
|
0x7E, 0x00, 0x3E, 0x00, 0x00, 0xF8, 0x01, 0x38, 0x00, 0x3C, 0x00, 0x00,
|
||||||
0x70, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
|
0x70, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, };
|
0x00, 0x00, 0x00, 0x00, };
|
@ -169,6 +169,8 @@ void portduinoSetup()
|
|||||||
settingsMap[displayPanel] = st7735;
|
settingsMap[displayPanel] = st7735;
|
||||||
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "ST7735S")
|
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "ST7735S")
|
||||||
settingsMap[displayPanel] = st7735s;
|
settingsMap[displayPanel] = st7735s;
|
||||||
|
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "ILI9341")
|
||||||
|
settingsMap[displayPanel] = ili9341;
|
||||||
settingsMap[displayHeight] = yamlConfig["Display"]["Height"].as<int>(0);
|
settingsMap[displayHeight] = yamlConfig["Display"]["Height"].as<int>(0);
|
||||||
settingsMap[displayWidth] = yamlConfig["Display"]["Width"].as<int>(0);
|
settingsMap[displayWidth] = yamlConfig["Display"]["Width"].as<int>(0);
|
||||||
settingsMap[displayDC] = yamlConfig["Display"]["DC"].as<int>(-1);
|
settingsMap[displayDC] = yamlConfig["Display"]["DC"].as<int>(-1);
|
||||||
@ -184,6 +186,8 @@ void portduinoSetup()
|
|||||||
if (yamlConfig["Touchscreen"]) {
|
if (yamlConfig["Touchscreen"]) {
|
||||||
if (yamlConfig["Touchscreen"]["Module"].as<std::string>("") == "XPT2046")
|
if (yamlConfig["Touchscreen"]["Module"].as<std::string>("") == "XPT2046")
|
||||||
settingsMap[touchscreenModule] = xpt2046;
|
settingsMap[touchscreenModule] = xpt2046;
|
||||||
|
else if (yamlConfig["Touchscreen"]["Module"].as<std::string>("") == "STMPE610")
|
||||||
|
settingsMap[touchscreenModule] = stmpe610;
|
||||||
settingsMap[touchscreenCS] = yamlConfig["Touchscreen"]["CS"].as<int>(-1);
|
settingsMap[touchscreenCS] = yamlConfig["Touchscreen"]["CS"].as<int>(-1);
|
||||||
settingsMap[touchscreenIRQ] = yamlConfig["Touchscreen"]["IRQ"].as<int>(-1);
|
settingsMap[touchscreenIRQ] = yamlConfig["Touchscreen"]["IRQ"].as<int>(-1);
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ enum configNames {
|
|||||||
keyboardDevice,
|
keyboardDevice,
|
||||||
logoutputlevel
|
logoutputlevel
|
||||||
};
|
};
|
||||||
enum { no_screen, st7789, st7735, st7735s };
|
enum { no_screen, st7789, st7735, st7735s, ili9341 };
|
||||||
enum { no_touchscreen, xpt2046 };
|
enum { no_touchscreen, xpt2046, stmpe610 };
|
||||||
enum { level_error, level_warn, level_info, level_debug };
|
enum { level_error, level_warn, level_info, level_debug };
|
||||||
|
|
||||||
extern std::map<configNames, int> settingsMap;
|
extern std::map<configNames, int> settingsMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user