Skip to content

Commit 20cfab6

Browse files
Added support for the nibble zero connect
1 parent 676c317 commit 20cfab6

File tree

3 files changed

+242
-0
lines changed

3 files changed

+242
-0
lines changed
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
[nibble_zero_connect_base]
2+
extends = esp32_base
3+
board = esp32-s3-zero
4+
build_flags =
5+
${esp32_base.build_flags}
6+
-I variants/nibble_zero_connect
7+
-D NIBBLE_ZERO_CONNECT
8+
-D P_LORA_DIO_1=4
9+
-D P_LORA_NSS=10
10+
-D P_LORA_RESET=6
11+
-D P_LORA_BUSY=5
12+
-D P_LORA_SCLK=12
13+
-D P_LORA_MISO=13
14+
-D P_LORA_MOSI=11
15+
-D PIN_USER_BTN=1
16+
-D PIN_BOARD_SDA=8
17+
-D PIN_BOARD_SCL=7
18+
-D DISPLAY_ROTATION=1
19+
-D HAS_NEOPIXEL
20+
-D NEOPIXEL_COUNT=1
21+
-D NEOPIXEL_DATA=17
22+
-D NEOPIXEL_TYPE=(NEO_GRB+NEO_KHZ800)
23+
-D SX126X_DIO2_AS_RF_SWITCH=true
24+
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
25+
-D SX126X_CURRENT_LIMIT=140
26+
-D RADIO_CLASS=CustomSX1262
27+
-D WRAPPER_CLASS=CustomSX1262Wrapper
28+
-D LORA_TX_POWER=22
29+
-D SX126X_RX_BOOSTED_GAIN=1
30+
build_src_filter = ${esp32_base.build_src_filter}
31+
+<../variants/nibble_zero_connect>
32+
lib_deps =
33+
${esp32_base.lib_deps}
34+
adafruit/Adafruit SSD1306 @ ^2.5.13
35+
adafruit/Adafruit NeoPixel @ ^1.12.3
36+
37+
[env:nibble_zero_connect_repeater]
38+
extends = nibble_zero_connect_base
39+
build_flags =
40+
${nibble_zero_connect_base.build_flags}
41+
-D DISPLAY_CLASS=SSD1306Display
42+
-D ADVERT_NAME='"Nibble Repeater"'
43+
-D ADVERT_LAT=0.0
44+
-D ADVERT_LON=0.0
45+
-D ADMIN_PASSWORD='"password"'
46+
-D MAX_NEIGHBOURS=50
47+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
48+
+<helpers/ui/SSD1306Display.cpp>
49+
+<../examples/simple_repeater>
50+
lib_deps =
51+
${nibble_zero_connect_base.lib_deps}
52+
${esp32_ota.lib_deps}
53+
54+
[env:nibble_zero_connect_repeater_bridge_espnow]
55+
extends = nibble_zero_connect_base
56+
build_flags =
57+
${nibble_zero_connect_base.build_flags}
58+
-D DISPLAY_CLASS=SSD1306Display
59+
-D ADVERT_NAME='"ESPNow Bridge"'
60+
-D ADVERT_LAT=0.0
61+
-D ADVERT_LON=0.0
62+
-D ADMIN_PASSWORD='"password"'
63+
-D MAX_NEIGHBOURS=50
64+
-D WITH_ESPNOW_BRIDGE=1
65+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
66+
+<helpers/bridges/ESPNowBridge.cpp>
67+
+<helpers/ui/SSD1306Display.cpp>
68+
+<../examples/simple_repeater>
69+
lib_deps =
70+
${nibble_zero_connect_base.lib_deps}
71+
${esp32_ota.lib_deps}
72+
73+
[env:nibble_zero_connect_terminal_chat]
74+
extends = nibble_zero_connect_base
75+
build_flags =
76+
${nibble_zero_connect_base.build_flags}
77+
-D MAX_CONTACTS=300
78+
-D MAX_GROUP_CHANNELS=1
79+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
80+
+<../examples/simple_secure_chat/main.cpp>
81+
lib_deps =
82+
${nibble_zero_connect_base.lib_deps}
83+
densaugeo/base64 @ ~1.4.0
84+
85+
[env:nibble_zero_connect_room_server]
86+
extends = nibble_zero_connect_base
87+
build_flags =
88+
${nibble_zero_connect_base.build_flags}
89+
-D DISPLAY_CLASS=SSD1306Display
90+
-D ADVERT_NAME='"Nibble Room"'
91+
-D ADVERT_LAT=0.0
92+
-D ADVERT_LON=0.0
93+
-D ADMIN_PASSWORD='"password"'
94+
-D ROOM_PASSWORD='"hello"'
95+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
96+
+<helpers/ui/SSD1306Display.cpp>
97+
+<../examples/simple_room_server>
98+
lib_deps =
99+
${nibble_zero_connect_base.lib_deps}
100+
${esp32_ota.lib_deps}
101+
102+
[env:nibble_zero_connect_companion_radio_usb]
103+
extends = nibble_zero_connect_base
104+
build_flags =
105+
${nibble_zero_connect_base.build_flags}
106+
-I examples/companion_radio/ui-new
107+
-D DISPLAY_CLASS=SSD1306Display
108+
-D MAX_CONTACTS=300
109+
-D MAX_GROUP_CHANNELS=8
110+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
111+
+<helpers/ui/SSD1306Display.cpp>
112+
+<helpers/ui/MomentaryButton.cpp>
113+
+<../examples/companion_radio/*.cpp>
114+
+<../examples/companion_radio/ui-new/*.cpp>
115+
lib_deps =
116+
${nibble_zero_connect_base.lib_deps}
117+
densaugeo/base64 @ ~1.4.0
118+
119+
[env:nibble_zero_connect_companion_radio_ble]
120+
extends = nibble_zero_connect_base
121+
build_flags =
122+
${nibble_zero_connect_base.build_flags}
123+
-I examples/companion_radio/ui-new
124+
-D DISPLAY_CLASS=SSD1306Display
125+
-D MAX_CONTACTS=300
126+
-D MAX_GROUP_CHANNELS=8
127+
-D BLE_PIN_CODE=123456
128+
-D BLE_DEBUG_LOGGING=1
129+
-D OFFLINE_QUEUE_SIZE=256
130+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
131+
+<helpers/esp32/*.cpp>
132+
+<helpers/ui/SSD1306Display.cpp>
133+
+<helpers/ui/MomentaryButton.cpp>
134+
+<../examples/companion_radio/*.cpp>
135+
+<../examples/companion_radio/ui-new/*.cpp>
136+
lib_deps =
137+
${nibble_zero_connect_base.lib_deps}
138+
densaugeo/base64 @ ~1.4.0
139+
140+
[env:nibble_zero_connect_companion_radio_wifi]
141+
extends = nibble_zero_connect_base
142+
build_flags =
143+
${nibble_zero_connect_base.build_flags}
144+
-I examples/companion_radio/ui-new
145+
-D DISPLAY_CLASS=SSD1306Display
146+
-D MAX_CONTACTS=300
147+
-D MAX_GROUP_CHANNELS=8
148+
-D WIFI_DEBUG_LOGGING=1
149+
-D WIFI_SSID='"myssid"'
150+
-D WIFI_PWD='"mypwd"'
151+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
152+
+<helpers/ui/SSD1306Display.cpp>
153+
+<helpers/ui/MomentaryButton.cpp>
154+
+<helpers/esp32/*.cpp>
155+
+<../examples/companion_radio/*.cpp>
156+
+<../examples/companion_radio/ui-new/*.cpp>
157+
lib_deps =
158+
${nibble_zero_connect_base.lib_deps}
159+
densaugeo/base64 @ ~1.4.0
160+
161+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include <Arduino.h>
2+
#include "target.h"
3+
4+
ESP32Board board;
5+
6+
static SPIClass spi;
7+
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
8+
WRAPPER_CLASS radio_driver(radio, board);
9+
10+
ESP32RTCClock fallback_clock;
11+
AutoDiscoverRTCClock rtc_clock(fallback_clock);
12+
SensorManager sensors;
13+
14+
#ifdef DISPLAY_CLASS
15+
DISPLAY_CLASS display;
16+
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
17+
#endif
18+
19+
#ifndef LORA_CR
20+
#define LORA_CR 5
21+
#endif
22+
23+
bool radio_init() {
24+
fallback_clock.begin();
25+
rtc_clock.begin(Wire);
26+
27+
return radio.std_init(&spi);
28+
}
29+
30+
uint32_t radio_get_rng_seed() {
31+
return radio.random(0x7FFFFFFF);
32+
}
33+
34+
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) {
35+
radio.setFrequency(freq);
36+
radio.setSpreadingFactor(sf);
37+
radio.setBandwidth(bw);
38+
radio.setCodingRate(cr);
39+
}
40+
41+
void radio_set_tx_power(uint8_t dbm) {
42+
radio.setOutputPower(dbm);
43+
}
44+
45+
mesh::LocalIdentity radio_new_identity() {
46+
RadioNoiseListener rng(radio);
47+
return mesh::LocalIdentity(&rng);
48+
}
49+
50+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#pragma once
2+
3+
#define RADIOLIB_STATIC_ONLY 1
4+
#include <RadioLib.h>
5+
#include <helpers/radiolib/RadioLibWrappers.h>
6+
#include <helpers/ESP32Board.h>
7+
#include <helpers/radiolib/CustomSX1262Wrapper.h>
8+
#include <helpers/AutoDiscoverRTCClock.h>
9+
#include <helpers/SensorManager.h>
10+
#ifdef DISPLAY_CLASS
11+
#include <helpers/ui/SSD1306Display.h>
12+
#include <helpers/ui/MomentaryButton.h>
13+
#endif
14+
15+
extern ESP32Board board;
16+
extern WRAPPER_CLASS radio_driver;
17+
extern AutoDiscoverRTCClock rtc_clock;
18+
extern SensorManager sensors;
19+
20+
#ifdef DISPLAY_CLASS
21+
extern DISPLAY_CLASS display;
22+
extern MomentaryButton user_btn;
23+
#endif
24+
25+
bool radio_init();
26+
uint32_t radio_get_rng_seed();
27+
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
28+
void radio_set_tx_power(uint8_t dbm);
29+
mesh::LocalIdentity radio_new_identity();
30+
31+

0 commit comments

Comments
 (0)