Skip to content

Commit

Permalink
feat: heltec wireless stick lite board
Browse files Browse the repository at this point in the history
  • Loading branch information
SQ2CPA committed Mar 22, 2024
1 parent a33875a commit 7897e9a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
9 changes: 4 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ board = heltec_wifi_lora_32_V3
board_build.mcu = esp32s3
build_flags = -Werror -Wall -DHELTEC_WS -DELEGANTOTA_USE_ASYNC_WEBSERVER=1

;[env:heltec_wireless_stick_lite]
;board = heltec_wireless_stick_lite
;board_build.mcu = esp32c3
;board_build.f_cpu = 240000000L
;build_flags = -Werror -Wall -DHELTEC_WSL -DELEGANTOTA_USE_ASYNC_WEBSERVER=1
[env:heltec_wireless_stick_lite]
board = heltec_wireless_stick_lite
board_build.mcu = esp32c3
build_flags = -Werror -Wall -DHELTEC_WSL -DELEGANTOTA_USE_ASYNC_WEBSERVER=1
20 changes: 20 additions & 0 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
#include "pins_config.h"
#include "display.h"

#ifdef HAS_DISPLAY
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RST);
#endif

extern Configuration Config;

void setup_display() {
#ifdef HAS_DISPLAY
Wire.begin(OLED_SDA, OLED_SCL);

if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Expand All @@ -27,17 +30,21 @@ void setup_display() {
display.ssd1306_command(1);
display.display();
delay(1000);
#endif
}

void display_toggle(bool toggle) {
#ifdef HAS_DISPLAY
if (toggle) {
display.ssd1306_command(SSD1306_DISPLAYON);
} else {
display.ssd1306_command(SSD1306_DISPLAYOFF);
}
#endif
}

void show_display(String line1, int wait) {
#ifdef HAS_DISPLAY
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
Expand All @@ -47,9 +54,11 @@ void show_display(String line1, int wait) {
display.ssd1306_command(1);
display.display();
delay(wait);
#endif
}

void show_display(String line1, String line2, int wait) {
#ifdef HAS_DISPLAY
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
Expand All @@ -61,9 +70,11 @@ void show_display(String line1, String line2, int wait) {
display.ssd1306_command(1);
display.display();
delay(wait);
#endif
}

void show_display(String line1, String line2, String line3, int wait) {
#ifdef HAS_DISPLAY
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
Expand All @@ -77,9 +88,11 @@ void show_display(String line1, String line2, String line3, int wait) {
display.ssd1306_command(1);
display.display();
delay(wait);
#endif
}

void show_display(String line1, String line2, String line3, String line4, int wait) {
#ifdef HAS_DISPLAY
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
Expand All @@ -95,9 +108,11 @@ void show_display(String line1, String line2, String line3, String line4, int wa
display.ssd1306_command(1);
display.display();
delay(wait);
#endif
}

void show_display(String line1, String line2, String line3, String line4, String line5, int wait) {
#ifdef HAS_DISPLAY
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
Expand All @@ -115,9 +130,11 @@ void show_display(String line1, String line2, String line3, String line4, String
display.ssd1306_command(1);
display.display();
delay(wait);
#endif
}

void show_display(String line1, String line2, String line3, String line4, String line5, String line6, int wait) {
#ifdef HAS_DISPLAY
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
Expand All @@ -137,9 +154,11 @@ void show_display(String line1, String line2, String line3, String line4, String
display.ssd1306_command(1);
display.display();
delay(wait);
#endif
}

void show_display(String line1, String line2, String line3, String line4, String line5, String line6, String line7, int wait) {
#ifdef HAS_DISPLAY
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
Expand All @@ -162,4 +181,5 @@ void show_display(String line1, String line2, String line3, String line4, String
display.ssd1306_command(1);
display.display();
delay(wait);
#endif
}
2 changes: 1 addition & 1 deletion src/lora_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

extern Configuration Config;

#if defined(HELTEC_V3) || defined(HELTEC_WS) || defined(TTGO_T_Beam_V1_2_SX1262)
#if defined(HELTEC_V3) || defined(HELTEC_WS) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(HELTEC_WSL)
SX1262 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN);
bool transmissionFlag = true;
bool enableInterrupt = true;
Expand Down
16 changes: 15 additions & 1 deletion src/pins_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#undef OLED_SCL
#undef OLED_RST

#if defined(HELTEC_V3) || defined(HELTEC_WS) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(OE5HWN_MeshCom)
#if defined(HELTEC_V3) || defined(HELTEC_WS) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(OE5HWN_MeshCom) || defined(HELTEC_WSL)
#define HAS_SX126X
#endif

Expand Down Expand Up @@ -79,6 +79,16 @@
#define RADIO_TXEN 13
#endif

#ifdef HELTEC_WSL
#define RADIO_SCLK_PIN 10 // SX1262 SCK
#define RADIO_MISO_PIN 6 // SX1262 MISO
#define RADIO_MOSI_PIN 7 // SX1262 MOSI
#define RADIO_CS_PIN 8 // SX1262 NSS
#define RADIO_RST_PIN 5 // SX1262 RST
#define RADIO_DIO1_PIN 3 // SX1262 DIO1
#define RADIO_BUSY_PIN 4 // SX1262 BUSY
#endif


// OLED
#if defined(TTGO_T_LORA32_V2_1) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(OE5HWN_MeshCom)
Expand All @@ -99,6 +109,10 @@
#define OLED_RST 21
#endif

#ifndef HELTEC_WSL
#define HAS_DISPLAY
#endif


// Leds and other stuff
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(HELTEC_WS) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
Expand Down

0 comments on commit 7897e9a

Please sign in to comment.