kopia lustrzana https://github.com/meshtastic/firmware
commit
7f0fd642ec
|
@ -94,7 +94,7 @@ static uint16_t displayWidth, displayHeight;
|
|||
#define SCREEN_WIDTH displayWidth
|
||||
#define SCREEN_HEIGHT displayHeight
|
||||
|
||||
#ifdef HAS_EINK
|
||||
#if defined(HAS_EINK) || defined(ILI9341_DRIVER)
|
||||
// The screen is bigger so use bigger fonts
|
||||
#define FONT_SMALL ArialMT_Plain_16
|
||||
#define FONT_MEDIUM ArialMT_Plain_24
|
||||
|
|
|
@ -313,7 +313,7 @@ class Screen : public concurrency::OSThread
|
|||
SH1106Wire dispdev;
|
||||
#elif defined(USE_SSD1306)
|
||||
SSD1306Wire dispdev;
|
||||
#elif defined(ST7735_CS)
|
||||
#elif defined(ST7735_CS) || defined(ILI9341_DRIVER)
|
||||
TFTDisplay dispdev;
|
||||
#elif defined(HAS_EINK)
|
||||
EInkDisplay dispdev;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "configuration.h"
|
||||
|
||||
#ifdef ST7735_CS
|
||||
#if defined(ST7735_CS) || defined(ILI9341_DRIVER)
|
||||
#include "SPILock.h"
|
||||
#include "TFTDisplay.h"
|
||||
#include <SPI.h>
|
||||
|
@ -10,7 +10,11 @@ static TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.
|
|||
|
||||
TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl)
|
||||
{
|
||||
setGeometry(GEOMETRY_RAWMODE, 160, 80);
|
||||
#ifdef SCREEN_ROTATE
|
||||
setGeometry(GEOMETRY_RAWMODE, TFT_HEIGHT, TFT_WIDTH);
|
||||
#else
|
||||
setGeometry(GEOMETRY_RAWMODE, TFT_WIDTH, TFT_HEIGHT);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Write the buffer to the display memory
|
||||
|
@ -20,12 +24,10 @@ void TFTDisplay::display(void)
|
|||
|
||||
// FIXME - only draw bits have changed (use backbuf similar to the other displays)
|
||||
// tft.drawBitmap(0, 0, buffer, 128, 64, TFT_YELLOW, TFT_BLACK);
|
||||
for (uint8_t y = 0; y < displayHeight; y++) {
|
||||
for (uint8_t x = 0; x < displayWidth; x++) {
|
||||
|
||||
for (uint16_t y = 0; y < displayHeight; y++) {
|
||||
for (uint16_t x = 0; x < displayWidth; x++) {
|
||||
// get src pixel in the page based ordering the OLED lib uses FIXME, super inefficent
|
||||
auto b = buffer[x + (y / 8) * displayWidth];
|
||||
auto isset = b & (1 << (y & 7));
|
||||
auto isset = buffer[x + (y / 8) * displayWidth] & (1 << (y & 7));
|
||||
tft.drawPixel(x, y, isset ? TFT_WHITE : TFT_BLACK);
|
||||
}
|
||||
}
|
||||
|
@ -38,21 +40,34 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||
// Drop all commands to device (we just update the buffer)
|
||||
}
|
||||
|
||||
void TFTDisplay::setDetected(uint8_t detected)
|
||||
{
|
||||
(void)detected;
|
||||
}
|
||||
|
||||
// Connect to the display
|
||||
bool TFTDisplay::connect()
|
||||
{
|
||||
concurrency::LockGuard g(spiLock);
|
||||
DEBUG_MSG("Doing TFT init\n");
|
||||
|
||||
#ifdef TFT_BL
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
#endif
|
||||
|
||||
#ifdef ST7735_BACKLIGHT_EN
|
||||
digitalWrite(ST7735_BACKLIGHT_EN, HIGH);
|
||||
pinMode(ST7735_BACKLIGHT_EN, OUTPUT);
|
||||
#endif
|
||||
|
||||
tft.init();
|
||||
#ifdef M5STACK
|
||||
tft.setRotation(1); // M5Stack has the TFT in landscape
|
||||
#else
|
||||
tft.setRotation(3); // Orient horizontal and wide underneath the silkscreen name label
|
||||
#endif
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
// tft.drawRect(0, 0, 40, 10, TFT_PURPLE); // wide rectangle in upper left
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@ class TFTDisplay : public OLEDDisplay
|
|||
// Write the buffer to the display memory
|
||||
virtual void display(void) override;
|
||||
|
||||
/**
|
||||
* shim to make the abstraction happy
|
||||
*
|
||||
*/
|
||||
void setDetected(uint8_t detected);
|
||||
|
||||
protected:
|
||||
// the header size of the buffer used, e.g. for the SPI command header
|
||||
virtual int getBufferOffset(void) override { return 0; }
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
[env:m5stack-core]
|
||||
extends = esp32_base
|
||||
board = m5stack-core-esp32
|
||||
upload_port = COM8
|
||||
monitor_port = COM8
|
||||
monitor_filters = esp32_exception_decoder
|
||||
build_flags =
|
||||
${esp32_base.build_flags} -D PRIVATE_HW -I variants/m5stack_core
|
||||
-DILI9341_DRIVER
|
||||
-DM5STACK
|
||||
-DUSER_SETUP_LOADED
|
||||
-DTFT_SDA_READ
|
||||
-DTFT_DRIVER=0x9341
|
||||
-DTFT_MISO=19
|
||||
-DTFT_MOSI=23
|
||||
-DTFT_SCLK=18
|
||||
-DTFT_CS=14
|
||||
-DTFT_DC=27
|
||||
-DTFT_RST=33
|
||||
-DTFT_BL=32
|
||||
-DSPI_FREQUENCY=40000000
|
||||
-DSPI_READ_FREQUENCY=16000000
|
||||
lib_ignore =
|
||||
m5stack-core
|
||||
lib_deps =
|
||||
${esp32_base.lib_deps}
|
||||
bodmer/TFT_eSPI@^2.4.61
|
|
@ -0,0 +1,42 @@
|
|||
// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep
|
||||
|
||||
#define I2C_SDA 21
|
||||
#define I2C_SCL 22
|
||||
|
||||
// #define BUTTON_PIN 39 // 38, 37
|
||||
//#define BUTTON_PIN 0
|
||||
#define BUTTON_NEED_PULLUP
|
||||
// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Plugin.
|
||||
|
||||
#define BUTTON_PIN 38
|
||||
|
||||
#undef RF95_SCK
|
||||
#undef RF95_MISO
|
||||
#undef RF95_MOSI
|
||||
#undef RF95_NSS
|
||||
|
||||
#define RF95_SCK 18
|
||||
#define RF95_MISO 19
|
||||
#define RF95_MOSI 23
|
||||
#define RF95_NSS 5
|
||||
|
||||
#define USE_RF95
|
||||
#define LORA_DIO0 36 // a No connect on the SX1262 module
|
||||
#define LORA_RESET 26
|
||||
#define LORA_DIO1 RADIOLIB_NC// Not really used
|
||||
#define LORA_DIO2 RADIOLIB_NC// Not really used
|
||||
|
||||
// This board has different GPS pins than all other boards
|
||||
#undef GPS_RX_PIN
|
||||
#undef GPS_TX_PIN
|
||||
#define GPS_RX_PIN 16
|
||||
#define GPS_TX_PIN 17
|
||||
|
||||
#define NO_GPS
|
||||
|
||||
// Define if screen should be mirrored left to right
|
||||
#define SCREEN_ROTATE
|
||||
|
||||
// LCD screens are slow, so slowdown the wipe so it looks better
|
||||
#define SCREEN_TRANSITION_MSECS 1
|
||||
#define SCREEN_TRANSITION_FRAMERATE 1 // fps
|
Ładowanie…
Reference in New Issue