One nRF52840 variant shared across both radios, picked per env: Duo runs the LR1121, Uno the SX1262. Same PCB, only the radio and its DIO1 pin change. SuperIO adds the SH1107 OLED, GPS, buzzer and joystick. GPS is driven by the 3-position mode switch (Mode 2 = on), polled live the way thinknode_m1 does it. Five quick user-button presses power the unit off; a press wakes it back on (arms the button as an nRF52 GPIO SENSE source before SYSTEMOFF). Consolidates #2054 and andyshinn's shared-base/uno work, rebased on dev. Co-authored-by: lbibass <ewdries02@gmail.com> Co-authored-by: Andy Shinn <andys@andyshinn.as>
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "DisplayDriver.h"
|
|
#include <Wire.h>
|
|
#include <Adafruit_GFX.h>
|
|
#define SH110X_NO_SPLASH
|
|
#include <Adafruit_SH110X.h>
|
|
|
|
#ifndef PIN_OLED_RESET
|
|
#define PIN_OLED_RESET -1
|
|
#endif
|
|
|
|
#ifndef DISPLAY_ADDRESS
|
|
#define DISPLAY_ADDRESS 0x3c
|
|
#endif
|
|
|
|
class SH1107Display : public DisplayDriver
|
|
{
|
|
Adafruit_SH1107 display;
|
|
bool _isOn;
|
|
uint8_t _color;
|
|
|
|
bool i2c_probe(TwoWire &wire, uint8_t addr);
|
|
|
|
public:
|
|
SH1107Display() : DisplayDriver(128, 128), display(128, 128, &Wire, PIN_OLED_RESET) { _isOn = false; }
|
|
bool begin();
|
|
|
|
bool isOn() override { return _isOn; }
|
|
void turnOn() override;
|
|
void turnOff() override;
|
|
void clear() override;
|
|
void startFrame(ColorVal bkg = UIColor::window_bkg) override;
|
|
void setTextSize(int sz) override;
|
|
void setColor(ColorVal c) override;
|
|
void setCursor(int x, int y) override;
|
|
void print(const char *str) override;
|
|
void fillRect(int x, int y, int w, int h) override;
|
|
void drawRect(int x, int y, int w, int h) override;
|
|
void drawXbm(int x, int y, const uint8_t *bits, int w, int h) override;
|
|
uint16_t getTextWidth(const char *str) override;
|
|
void endFrame() override;
|
|
};
|