Skip to content

Commit 24edd3c

Browse files
committed
thinknode_m5: add pca9557 expander
1 parent d0f6def commit 24edd3c

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

variants/thinknode_m5/ThinknodeM5Board.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#include "ThinknodeM5Board.h"
22

33

4-
54
void ThinknodeM5Board::begin() {
65
pinMode(PIN_VEXT_EN, OUTPUT);
76
digitalWrite(PIN_VEXT_EN, !PIN_VEXT_EN_ACTIVE); // force power cycle
87
delay(20); // allow power rail to discharge
98
digitalWrite(PIN_VEXT_EN, PIN_VEXT_EN_ACTIVE); // turn backlight back on
109
delay(120); // give display time to bias on cold boot
1110
ESP32Board::begin();
12-
pinMode(PIN_STATUS_LED, OUTPUT); // init power led
11+
// pinMode(PIN_STATUS_LED, OUTPUT); // init power led
1312
}
1413

1514
void ThinknodeM5Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) {

variants/thinknode_m5/platformio.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ build_flags = ${esp32_base.build_flags}
1919
-D P_LORA_MISO=7
2020
-D P_LORA_MOSI=15
2121
-D PIN_USER_BTN=21
22-
-D PIN_STATUS_LED=1
23-
-D LED_STATE_ON=HIGH
24-
-D PIN_LED=3
22+
# -D PIN_STATUS_LED=1 ; leds are on PCA !!!
23+
# -D LED_STATE_ON=HIGH
24+
# -D PIN_LED=3
2525
-D DISPLAY_ROTATION=4
2626
-D DISPLAY_CLASS=GxEPDDisplay
2727
-D EINK_DISPLAY_MODEL=GxEPD2_154_D67
@@ -45,6 +45,7 @@ build_src_filter = ${esp32_base.build_src_filter}
4545
lib_deps = ${esp32_base.lib_deps}
4646
zinggjm/GxEPD2 @ 1.6.2
4747
bakercp/CRC32 @ ^2.0.0
48+
maxpromer/PCA9557-arduino
4849

4950
[env:ThinkNode_M5_Repeater]
5051
extends = ThinkNode_M5

variants/thinknode_m5/target.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ WRAPPER_CLASS radio_driver(radio, board);
1515
ESP32RTCClock fallback_clock;
1616
AutoDiscoverRTCClock rtc_clock(fallback_clock);
1717
SensorManager sensors;
18+
PCA9557 expander (0x18, &Wire1);
1819

1920
#ifdef DISPLAY_CLASS
2021
DISPLAY_CLASS display;
@@ -26,6 +27,11 @@ bool radio_init() {
2627
rtc_clock.begin(Wire);
2728
// pinMode(21, INPUT);
2829
// pinMode(48, OUTPUT);
30+
Wire1.begin(48, 47);
31+
expander.pinMode(4, OUTPUT); // eink
32+
expander.pinMode(5, OUTPUT); // peripherals
33+
expander.digitalWrite(4, HIGH);
34+
expander.digitalWrite(5, HIGH);
2935
#if defined(P_LORA_SCLK)
3036
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
3137
return radio.std_init(&spi);

variants/thinknode_m5/target.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
#include <helpers/ui/GxEPDDisplay.h>
1313
#include <helpers/ui/MomentaryButton.h>
1414
#endif
15+
#include <Wire.h>
16+
#include <PCA9557.h>
1517

1618
extern ThinknodeM5Board board;
1719
extern WRAPPER_CLASS radio_driver;
1820
extern AutoDiscoverRTCClock rtc_clock;
1921
extern SensorManager sensors;
22+
extern PCA9557 expander;
2023

2124
#ifdef DISPLAY_CLASS
2225
extern DISPLAY_CLASS display;

variants/thinknode_m5/variant.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#define PIN_VEXT_EN_ACTIVE HIGH
88
#define PIN_VEXT_EN 46
99
#define PIN_USER_BTN 21
10-
#define PIN_LED 3
11-
#define PIN_STATUS_LED 1
10+
//#define PIN_LED 3
11+
//#define PIN_STATUS_LED 1
1212
#define PIN_PWRBTN 14
1313

1414
#define PIN_DISPLAY_MISO (-1)
@@ -18,4 +18,4 @@
1818
#define PIN_DISPLAY_DC (40)
1919
#define PIN_DISPLAY_RST (41)
2020
#define PIN_DISPLAY_BUSY (42)
21-
#define DISP_BACKLIGHT (5)
21+
//#define DISP_BACKLIGHT (5)

0 commit comments

Comments
 (0)