mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2024-10-01 03:15:39 -04:00
Added display support for T-Beam, Heltec and LoRa32 boards
This commit is contained in:
parent
d2dab8c65e
commit
3b0658aaf5
2
Config.h
2
Config.h
@ -170,7 +170,7 @@
|
|||||||
const int pin_led_rx = 25;
|
const int pin_led_rx = 25;
|
||||||
const int pin_led_tx = 25;
|
const int pin_led_tx = 25;
|
||||||
#endif
|
#endif
|
||||||
#define HAS_DISPLAY true
|
#define HAS_DISPLAY true
|
||||||
#define HAS_BLUETOOTH true
|
#define HAS_BLUETOOTH true
|
||||||
#elif BOARD_MODEL == BOARD_RNODE_NG_20
|
#elif BOARD_MODEL == BOARD_RNODE_NG_20
|
||||||
const int pin_cs = 18;
|
const int pin_cs = 18;
|
||||||
|
29
Display.h
29
Display.h
@ -4,8 +4,22 @@
|
|||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
#define DISP_W 128
|
#define DISP_W 128
|
||||||
#define DISP_H 64
|
#define DISP_H 64
|
||||||
#define DISP_RST -1
|
#if BOARD_MODEL == BOARD_RNODE_NG_20 || BOARD_MODEL == BOARD_LORA32_V2_0
|
||||||
#define DISP_ADDR 0x3c
|
#define DISP_RST -1
|
||||||
|
#define DISP_ADDR 0x3C
|
||||||
|
#elif BOARD_MODEL == BOARD_TBEAM
|
||||||
|
#define DISP_RST 23
|
||||||
|
#define DISP_ADDR 0x3D
|
||||||
|
#elif BOARD_MODEL == BOARD_HELTEC32_V2
|
||||||
|
#define DISP_RST 16
|
||||||
|
#define DISP_ADDR 0x3C
|
||||||
|
#define SCL_OLED 15
|
||||||
|
#define SDA_OLED 4
|
||||||
|
#else
|
||||||
|
#define DISP_RST -1
|
||||||
|
#define DISP_ADDR 0x3C
|
||||||
|
#endif
|
||||||
|
|
||||||
Adafruit_SSD1306 display(DISP_W, DISP_H, &Wire, DISP_RST);
|
Adafruit_SSD1306 display(DISP_W, DISP_H, &Wire, DISP_RST);
|
||||||
|
|
||||||
#define DISP_MODE_UNKNOWN 0x00
|
#define DISP_MODE_UNKNOWN 0x00
|
||||||
@ -54,6 +68,8 @@ bool display_init() {
|
|||||||
digitalWrite(pin_display_en, LOW);
|
digitalWrite(pin_display_en, LOW);
|
||||||
delay(50);
|
delay(50);
|
||||||
digitalWrite(pin_display_en, HIGH);
|
digitalWrite(pin_display_en, HIGH);
|
||||||
|
#elif BOARD_MODEL == BOARD_HELTEC32_V2
|
||||||
|
Wire.begin(SDA_OLED, SCL_OLED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!display.begin(SSD1306_SWITCHCAPVCC, DISP_ADDR)) {
|
if(!display.begin(SSD1306_SWITCHCAPVCC, DISP_ADDR)) {
|
||||||
@ -65,9 +81,18 @@ bool display_init() {
|
|||||||
#elif BOARD_MODEL == BOARD_RNODE_NG_21
|
#elif BOARD_MODEL == BOARD_RNODE_NG_21
|
||||||
disp_mode = DISP_MODE_PORTRAIT;
|
disp_mode = DISP_MODE_PORTRAIT;
|
||||||
display.setRotation(3);
|
display.setRotation(3);
|
||||||
|
#elif BOARD_MODEL == BOARD_LORA32_V2_0
|
||||||
|
disp_mode = DISP_MODE_PORTRAIT;
|
||||||
|
display.setRotation(3);
|
||||||
#elif BOARD_MODEL == BOARD_LORA32_V2_1
|
#elif BOARD_MODEL == BOARD_LORA32_V2_1
|
||||||
disp_mode = DISP_MODE_LANDSCAPE;
|
disp_mode = DISP_MODE_LANDSCAPE;
|
||||||
display.setRotation(0);
|
display.setRotation(0);
|
||||||
|
#elif BOARD_MODEL == BOARD_TBEAM
|
||||||
|
disp_mode = DISP_MODE_LANDSCAPE;
|
||||||
|
display.setRotation(0);
|
||||||
|
#elif BOARD_MODEL == BOARD_HELTEC32_V2
|
||||||
|
disp_mode = DISP_MODE_PORTRAIT;
|
||||||
|
display.setRotation(1);
|
||||||
#else
|
#else
|
||||||
disp_mode = DISP_MODE_PORTRAIT;
|
disp_mode = DISP_MODE_PORTRAIT;
|
||||||
display.setRotation(3);
|
display.setRotation(3);
|
||||||
|
@ -461,7 +461,6 @@ void serial_write(uint8_t byte) {
|
|||||||
if (bt_state != BT_STATE_CONNECTED) {
|
if (bt_state != BT_STATE_CONNECTED) {
|
||||||
Serial.write(byte);
|
Serial.write(byte);
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("BT Echo: %02X\n", byte);
|
|
||||||
SerialBT.write(byte);
|
SerialBT.write(byte);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user