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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue