M5stack display support (experimental)

This commit is contained in:
Klaus K Wilting committed 2020-04-05 18:19:39 +02:00
1 parent 07d5b18cc1
commit 70d836d2f6
4 files changed
+30 -28

No files matched your search

+16 -13
View File
@@ -70,7 +70,7 @@ void dp_setup(int contrast) {
tft.init();
tft.setRotation(MY_DISPLAY_FLIP ? true : false);
tft.setRotation(MY_DISPLAY_FLIP ? 3 : 1);
tft.invertDisplay(MY_DISPLAY_INVERT ? true : false);
tft.setTextColor(MY_DISPLAY_FGCOLOR, MY_DISPLAY_BGCOLOR);
@@ -433,23 +433,26 @@ void dp_printf(uint16_t x, uint16_t y, uint8_t font, uint8_t inv,
#if (HAS_DISPLAY) == 1
oledWriteString(&ssoled, 0, x, y, temp, font, inv, false);
#elif (HAS_DISPLAY) == 2
uint8_t myfont;
uint8_t tft_font, font_vScale;
// map font oled -> tft
switch (font) {
case MY_FONT_SMALL:
myfont = 6;
case MY_FONT_STRETCHED: // 16x16 on OLED
case MY_FONT_LARGE: // 16x32 on OLED
tft_font = 4; // 26px
font_vScale = 26;
break;
case MY_FONT_NORMAL:
case MY_FONT_LARGE:
myfont = 8;
break;
case MY_FONT_STRETCHED:
myfont = 16;
case MY_FONT_SMALL: // 6x8 on OLED
case MY_FONT_NORMAL: // 8x8 on OLED
tft_font = 2; // 16px
font_vScale = 16;
break;
default:
myfont = 8;
tft_font = 2; // 16px
font_vScale = 16;
}
tft.drawString(temp, x * tft.textWidth("_", font) / myfont,
y * tft.fontHeight(font), font);
tft.setCursor(x, y * font_vScale, tft_font);
tft.printf(temp);
#endif
if (temp != loc_buf) {
+5 -5
View File
@@ -64,14 +64,14 @@
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
//#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
//#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
//#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define SPI_FREQUENCY 40000000
+5 -5
View File
@@ -65,14 +65,14 @@
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
//#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
//#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
//#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define SPI_FREQUENCY 40000000