ppr1 st7567 lcd kinda works now

This commit is contained in:
Kevin Hester 2020-10-23 18:00:43 +08:00
parent a102e49fdb
commit b081a6da56
6 changed files with 28 additions and 12 deletions

View File

@ -5,7 +5,13 @@
## RAK815
TODO:
### PPR1 TODO
* Test GPS
* make ST7567Wire driver less ugly
* leave LCD screen on most of the time (because it needs little power)
### general nrf52 TODO:
- enter SDS state at correct time (to protect battery or loss of phone contact)
- show screen on eink when we enter SDS state (with app info and say sleeping)

View File

@ -139,6 +139,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// -----------------------------------------------------------------------------
#define SSD1306_ADDRESS 0x3C
#define ST7567_ADDRESS 0x3F
// The SH1106 controller is almost, but not quite, the same as SSD1306
// Define this if you know you have that controller or your "SSD1306" misbehaves.

View File

@ -6,6 +6,8 @@
#ifdef USE_SH1106
#include <SH1106Wire.h>
#elif defined(USE_ST7567)
#include <ST7567Wire.h>
#else
#include <SSD1306Wire.h>
#endif
@ -250,6 +252,8 @@ class Screen : public concurrency::OSThread
EInkDisplay dispdev;
#elif defined(USE_SH1106)
SH1106Wire dispdev;
#elif defined(USE_ST7567)
ST7567Wire dispdev;
#else
SSD1306Wire dispdev;
#endif

View File

@ -50,7 +50,9 @@ meshtastic::GPSStatus *gpsStatus = new meshtastic::GPSStatus();
// Global Node status
meshtastic::NodeStatus *nodeStatus = new meshtastic::NodeStatus();
bool ssd1306_found;
/// The I2C address of our display (if found)
uint8_t screen_found;
bool axp192_found;
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
@ -72,9 +74,13 @@ void scanI2Cdevice(void)
nDevices++;
if (addr == SSD1306_ADDRESS) {
ssd1306_found = true;
screen_found = addr;
DEBUG_MSG("ssd1306 display found\n");
}
if (addr == ST7567_ADDRESS) {
screen_found = addr;
DEBUG_MSG("st7567 display found\n");
}
#ifdef AXP192_SLAVE_ADDRESS
if (addr == AXP192_SLAVE_ADDRESS) {
axp192_found = true;
@ -247,7 +253,7 @@ void setup()
#endif
#ifdef PIN_LCD_RESET
// FIXME - move this someplace better
// FIXME - move this someplace better, LCD is at address 0x3F
pinMode(PIN_LCD_RESET, OUTPUT);
digitalWrite(PIN_LCD_RESET, 0);
delay(20);
@ -270,7 +276,7 @@ void setup()
#ifndef NO_ESP32
// Don't init display if we don't have one or we are waking headless due to a timer event
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER)
ssd1306_found = false; // forget we even have the hardware
screen_found = 0; // forget we even have the hardware
esp32Setup();
#endif
@ -296,11 +302,11 @@ void setup()
#endif
// Initialize the screen first so we can show the logo while we start up everything else.
screen = new graphics::Screen(SSD1306_ADDRESS);
screen = new graphics::Screen(screen_found);
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
// If we don't have bidirectional comms, we can't even try talking to UBLOX
// If we don't have bidirectional comms, we can't even try talking to UBLOX
UBloxGPS *ublox = NULL;
#ifdef GPS_TX_PIN
// Init GPS - first try ublox
@ -332,7 +338,7 @@ void setup()
gpsStatus->observe(&gps->newStatus);
else
DEBUG_MSG("Warning: No GPS found - running without GPS\n");
nodeStatus->observe(&nodeDB.newStatus);
service.init();
@ -342,11 +348,11 @@ void setup()
#if defined(ST7735_CS) || defined(HAS_EINK)
screen->setup();
#else
if (ssd1306_found)
if (screen_found)
screen->setup();
#endif
screen->print("Started...\n");
screen->print("Started...\n");
// We have now loaded our saved preferences from flash
@ -401,7 +407,6 @@ void setup()
// Initialize Wifi
initWifi();
if (!rIf)
recordCriticalError(ErrNoRadio);

View File

@ -6,7 +6,6 @@
#include "graphics/Screen.h"
extern bool axp192_found;
extern bool ssd1306_found;
extern bool isCharging;
extern bool isUSBPowered;

View File

@ -117,6 +117,7 @@ static const uint8_t AREF = PIN_AREF;
// LCD
#define PIN_LCD_RESET 23 // active low, pulse low for 20ms at boot
#define USE_ST7567
/*
* SPI Interfaces