Skip to content

Commit f907998

Browse files
authored
Merge pull request #724 from recrof/thinknode_m1_refactor
tidy up thinknode_m1 variant
2 parents 46b3910 + d610b7b commit f907998

File tree

4 files changed

+27
-39
lines changed

4 files changed

+27
-39
lines changed

src/helpers/nrf52/ThinkNodeM1Board.cpp renamed to variants/thinknode_m1/ThinkNodeM1Board.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#include <Arduino.h>
21
#include "ThinkNodeM1Board.h"
2+
#include <Arduino.h>
33

44
#ifdef THINKNODE_M1
55

6-
#include <bluefruit.h>
76
#include <Wire.h>
7+
#include <bluefruit.h>
88

99
static BLEDfu bledfu;
1010

@@ -26,14 +26,14 @@ void ThinkNodeM1Board::begin() {
2626

2727
Wire.begin();
2828

29-
#ifdef P_LORA_TX_LED
30-
pinMode(P_LORA_TX_LED, OUTPUT);
31-
digitalWrite(P_LORA_TX_LED, LOW);
32-
#endif
29+
#ifdef P_LORA_TX_LED
30+
pinMode(P_LORA_TX_LED, OUTPUT);
31+
digitalWrite(P_LORA_TX_LED, LOW);
32+
#endif
3333

3434
pinMode(SX126X_POWER_EN, OUTPUT);
3535
digitalWrite(SX126X_POWER_EN, HIGH);
36-
delay(10); // give sx1262 some time to power up
36+
delay(10); // give sx1262 some time to power up
3737
}
3838

3939
uint16_t ThinkNodeM1Board::getBattMilliVolts() {
@@ -50,7 +50,7 @@ uint16_t ThinkNodeM1Board::getBattMilliVolts() {
5050
return (uint16_t)((float)adcvalue * REAL_VBAT_MV_PER_LSB);
5151
}
5252

53-
bool ThinkNodeM1Board::startOTAUpdate(const char* id, char reply[]) {
53+
bool ThinkNodeM1Board::startOTAUpdate(const char *id, char reply[]) {
5454
// Config the peripheral connection with maximum bandwidth
5555
// more SRAM required by SoftDevice
5656
// Note: All config***() function must be called before begin()

src/helpers/nrf52/ThinkNodeM1Board.h renamed to variants/thinknode_m1/ThinkNodeM1Board.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@
33
#include <MeshCore.h>
44
#include <Arduino.h>
55

6-
// LoRa radio module pins for Elecrow ThinkNode M1
7-
#define P_LORA_DIO_1 20
8-
#define P_LORA_NSS 24
9-
#define P_LORA_RESET 25
10-
#define P_LORA_BUSY 17
11-
#define P_LORA_SCLK 19
12-
#define P_LORA_MISO 23
13-
#define P_LORA_MOSI 22
14-
#define SX126X_POWER_EN 37
15-
16-
#define SX126X_DIO2_AS_RF_SWITCH true
17-
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
18-
196
// built-ins
207
#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
218

variants/thinknode_m1/platformio.ini

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1-
[nrf52840_thinknode_m1]
1+
[ThinkNode_M1]
22
extends = nrf52_base
3-
platform_packages = framework-arduinoadafruitnrf52
3+
board = thinknode_m1
4+
board_build.ldscript = boards/nrf52840_s140_v6.ld
45
build_flags = ${nrf52_base.build_flags}
56
-I src/helpers/nrf52
67
-I lib/nrf52/s140_nrf52_6.1.1_API/include
78
-I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52
8-
lib_deps =
9-
${nrf52_base.lib_deps}
10-
rweather/Crypto @ ^0.4.0
11-
12-
[ThinkNode_M1]
13-
extends = nrf52840_thinknode_m1
14-
board = thinknode_m1
15-
board_build.ldscript = boards/nrf52840_s140_v6.ld
16-
build_flags = ${nrf52840_thinknode_m1.build_flags}
179
-I variants/thinknode_m1
1810
-D THINKNODE_M1=1
1911
-D RADIO_CLASS=CustomSX1262
2012
-D WRAPPER_CLASS=CustomSX1262Wrapper
21-
-D LORA_TX_POWER=22
22-
-D P_LORA_TX_LED=13
13+
-D P_LORA_DIO_1=20
14+
-D P_LORA_NSS=24
15+
-D P_LORA_RESET=25
16+
-D P_LORA_BUSY=17
17+
-D P_LORA_SCLK=19
18+
-D P_LORA_MISO=23
19+
-D P_LORA_MOSI=22
20+
-D SX126X_POWER_EN=37
21+
-D SX126X_DIO2_AS_RF_SWITCH=true
22+
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
2323
-D SX126X_CURRENT_LIMIT=140
2424
-D SX126X_RX_BOOSTED_GAIN=1
25-
build_src_filter = ${nrf52840_thinknode_m1.build_src_filter}
25+
-D LORA_TX_POWER=22
26+
-D P_LORA_TX_LED=13
27+
build_src_filter = ${nrf52_base.build_src_filter}
2628
+<helpers/*.cpp>
27-
+<helpers/nrf52/ThinkNodeM1Board.cpp>
29+
+<ThinkNodeM1Board.cpp>
2830
+<../variants/thinknode_m1>
2931
lib_deps =
30-
${nrf52840_thinknode_m1.lib_deps}
32+
${nrf52_base.lib_deps}
3133
stevemarple/MicroNMEA @ ^2.0.6
3234
debug_tool = jlink
3335
upload_protocol = nrfutil
@@ -81,7 +83,6 @@ build_flags =
8183
; -D MESH_PACKET_LOGGING=1
8284
; -D MESH_DEBUG=1
8385
build_src_filter = ${ThinkNode_M1.build_src_filter}
84-
+<helpers/nrf52/ThinkNodeM1.cpp>
8586
+<helpers/nrf52/SerialBLEInterface.cpp>
8687
+<helpers/ui/GxEPDDisplay.cpp>
8788
+<helpers/ui/buzzer.cpp>

variants/thinknode_m1/target.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define RADIOLIB_STATIC_ONLY 1
44
#include <RadioLib.h>
55
#include <helpers/radiolib/RadioLibWrappers.h>
6-
#include <helpers/nrf52/ThinkNodeM1Board.h>
6+
#include <ThinkNodeM1Board.h>
77
#include <helpers/radiolib/CustomSX1262Wrapper.h>
88
#include <helpers/AutoDiscoverRTCClock.h>
99
#include <helpers/SensorManager.h>

0 commit comments

Comments
 (0)