mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
display is working now
This commit is contained in:
parent
6af92b1fe8
commit
fa077d1cd8
8 changed files with 101 additions and 27 deletions
|
|
@ -2,6 +2,10 @@
|
|||
#include <Adafruit_GrayOLED.h>
|
||||
#include "Adafruit_SH110X.h"
|
||||
|
||||
#ifndef DISPLAY_ROTATION
|
||||
#define DISPLAY_ROTATION 0
|
||||
#endif
|
||||
|
||||
bool SH1107Display::i2c_probe(TwoWire &wire, uint8_t addr)
|
||||
{
|
||||
wire.beginTransmission(addr);
|
||||
|
|
@ -11,7 +15,11 @@ bool SH1107Display::i2c_probe(TwoWire &wire, uint8_t addr)
|
|||
|
||||
bool SH1107Display::begin()
|
||||
{
|
||||
return display.begin(DISPLAY_ADDRESS, true) && i2c_probe(Wire, DISPLAY_ADDRESS);
|
||||
bool result = display.begin(DISPLAY_ADDRESS, true) && i2c_probe(Wire, DISPLAY_ADDRESS);
|
||||
if (result) {
|
||||
display.setRotation(DISPLAY_ROTATION);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void SH1107Display::turnOn()
|
||||
|
|
@ -35,6 +43,8 @@ void SH1107Display::clear()
|
|||
void SH1107Display::startFrame(Color bkg)
|
||||
{
|
||||
display.clearDisplay(); // TODO: apply 'bkg'
|
||||
display.setContrast(300); // 0-255. default setting was causing some flickering.
|
||||
// display.SH110X_SETPRECHARGE(255);
|
||||
_color = SH110X_WHITE;
|
||||
display.setTextColor(_color);
|
||||
display.setTextSize(1);
|
||||
|
|
|
|||
|
|
@ -11,14 +11,15 @@
|
|||
#ifndef PIN_OLED_12V_EN
|
||||
#define PIN_OLED_12V_EN -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_ADDRESS
|
||||
#define DISPLAY_ADDRESS 0x3D
|
||||
#define DISPLAY_ADDRESS 0x3c
|
||||
#endif
|
||||
|
||||
class SH1107Display : public DisplayDriver
|
||||
{
|
||||
Adafruit_SH1107G display;
|
||||
Adafruit_SH1107 display;
|
||||
bool _isOn;
|
||||
uint8_t _color;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,18 +23,28 @@ void muzi_base_duoBoard::initiateShutdown(uint8_t reason) {
|
|||
|
||||
void muzi_base_duoBoard::begin() {
|
||||
NRF52BoardDCDC::begin();
|
||||
|
||||
pinMode(PIN_VBAT_READ, INPUT);
|
||||
pinMode(SCREEN_12V_ENABLE, OUTPUT);
|
||||
digitalWrite(SCREEN_12V_ENABLE, HIGH); // Enable 12V power for SH1107 display
|
||||
delay(250);
|
||||
Wire.begin();
|
||||
// delay(1000); // wait for display to initialize. otherwise it doesn't come up on boot.
|
||||
|
||||
#ifdef PIN_USER_BTN
|
||||
pinMode(PIN_USER_BTN, INPUT_PULLUP);
|
||||
#endif
|
||||
pinMode(PIN_BUTTON1, INPUT_PULLUP);
|
||||
pinMode(PIN_BUTTON2, INPUT_PULLUP);
|
||||
pinMode(PIN_BUTTON3, INPUT_PULLUP);
|
||||
pinMode(PIN_BUTTON4, INPUT_PULLUP);
|
||||
pinMode(PIN_BUTTON5, INPUT_PULLUP);
|
||||
pinMode(PIN_BUTTON6, INPUT_PULLUP);
|
||||
|
||||
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
||||
#endif
|
||||
// #if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||
// Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
||||
// #endif
|
||||
#ifdef NRF52_POWER_MANAGEMENT
|
||||
checkBootVoltage(&power_config);
|
||||
#endif
|
||||
delay(10); // give sx1262 some time to power up
|
||||
// delay(10); // give LR1121 some time to power up
|
||||
}
|
||||
|
|
@ -117,3 +117,41 @@ lib_deps = ${muzi_base_duo.lib_deps}
|
|||
densaugeo/base64 @ ~1.4.0
|
||||
; stevemarple/MicroNMEA @ ^2.0.6
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
[env:muzi_base_duo_companion_radio_ble_superIO]
|
||||
extends = muzi_base_duo
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_duo.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_TX_POWER=0
|
||||
-D QSPIFLASH=1
|
||||
-D UI_HAS_JOYSTICK=1
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=SH1107Display
|
||||
-D DISPLAY_ROTATION=2
|
||||
; -D ADVERT_NAME='"@@MAC"'
|
||||
-D ENV_INCLUDE_GPS=1
|
||||
; -D PIN_BUZZER=22
|
||||
build_src_filter = ${muzi_base_duo.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<helpers/sensors>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
+<helpers/ui/SH1107Display.cpp>
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
|
||||
lib_deps = ${muzi_base_duo.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
stevemarple/MicroNMEA @ ^2.0.6
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
adafruit/Adafruit SH110X@^2.1.14
|
||||
artronshop/ArtronShop_RX8130CE@1.0.0
|
||||
adafruit/Adafruit GFX Library @ ^1.12.1
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
#include "variant.h"
|
||||
// #include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
|
||||
muzi_base_duoBoard board;
|
||||
|
||||
|
|
@ -9,12 +8,22 @@ RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BU
|
|||
|
||||
WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock rtc_clock;
|
||||
// MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
#endif
|
||||
|
||||
EnvironmentSensorManager sensors; // only enable environment sensors. GPS is disabled.
|
||||
#ifdef DISPLAY_CLASS
|
||||
NullDisplayDriver display;
|
||||
DISPLAY_CLASS display;
|
||||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true, false, false);
|
||||
MomentaryButton joystick_left(JOYSTICK_LEFT, 1000, true, false, false);
|
||||
MomentaryButton joystick_right(JOYSTICK_RIGHT, 1000, true, false, false);
|
||||
MomentaryButton back_btn(PIN_BACK_BTN, 1000, true, false, true);
|
||||
#endif
|
||||
|
||||
#ifndef LORA_CR
|
||||
|
|
|
|||
|
|
@ -8,19 +8,24 @@
|
|||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
#include <helpers/sensors/LocationProvider.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/sensors/EnvironmentSensorManager.h> // Added: Include for EnvironmentSensorManager
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include "NullDisplayDriver.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
extern NullDisplayDriver display;
|
||||
#include <helpers/ui/SH1107Display.h>
|
||||
extern DISPLAY_CLASS display;
|
||||
#include <helpers/ui/MomentaryButton.h>
|
||||
extern MomentaryButton user_btn;
|
||||
extern MomentaryButton joystick_left;
|
||||
extern MomentaryButton joystick_right;
|
||||
extern MomentaryButton joystick_up;
|
||||
extern MomentaryButton joystick_down;
|
||||
extern MomentaryButton back_btn;
|
||||
#endif
|
||||
|
||||
extern muzi_base_duoBoard board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern VolatileRTCClock rtc_clock;
|
||||
extern AutoDiscoverRTCClock rtc_clock;
|
||||
extern EnvironmentSensorManager sensors;
|
||||
|
||||
bool radio_init();
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@ void initVariant()
|
|||
digitalWrite(LED_BLUE, LOW);
|
||||
pinMode(BUZZER_PIN, OUTPUT);
|
||||
digitalWrite(BUZZER_PIN, LOW); // turn off buzzer at start. don't leave it high.
|
||||
pinMode(GPS_EN, OUTPUT);
|
||||
digitalWrite(GPS_EN, LOW); // lets turn off the GPS at start. we can turn it on when we need it.
|
||||
pinMode(GPS_EN_GPIO, OUTPUT);
|
||||
digitalWrite(GPS_EN_GPIO, HIGH); // needs to turn on for GPS detection
|
||||
|
||||
pinMode(SCREEN_12V_ENABLE, OUTPUT);
|
||||
digitalWrite(SCREEN_12V_ENABLE, LOW); //
|
||||
}
|
||||
digitalWrite(SCREEN_12V_ENABLE, LOW); // disable 12V power for SH1107 display for now.
|
||||
}
|
||||
|
|
@ -67,6 +67,7 @@ static const uint8_t AREF = (PIN_AREF); // not used
|
|||
#define PIN_WIRE1_SCL (6) // P0.6
|
||||
#define PIN_WIRE_SDA (24) // P0.24 OLED I2C
|
||||
#define PIN_WIRE_SCL (25) // P0.25 OLED I2C
|
||||
#define I2C_NO_RESCAN
|
||||
// #define I2C_NO_RESCAN
|
||||
// #define HAS_QMA6100P
|
||||
// #define QMA_6100P_INT_PIN (34) // P1.2
|
||||
|
|
@ -134,10 +135,10 @@ static const uint8_t AREF = (PIN_AREF); // not used
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// GPS
|
||||
// #define HAS_GPS 1
|
||||
#define GPS_RX_PIN PIN_SERIAL1_RX
|
||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||
#define GPS_EN (32+1) // P1.01 PWR_IO2 on schematic. just cuts power to gps.
|
||||
#define HAS_GPS 1
|
||||
#define PIN_GPS_RX PIN_SERIAL1_RX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_TX
|
||||
#define GPS_EN_GPIO (32+1) // P1.01 PWR_IO2 on schematic. just cuts power to gps.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Buzzer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue