Skip to content

Commit bcee346

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

File tree

3 files changed

+241
-0
lines changed

3 files changed

+241
-0
lines changed
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
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 HAS_NEOPIXEL
19+
-D NEOPIXEL_COUNT=1
20+
-D NEOPIXEL_DATA=17
21+
-D NEOPIXEL_TYPE=(NEO_GRB+NEO_KHZ800)
22+
-D SX126X_DIO2_AS_RF_SWITCH=true
23+
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
24+
-D SX126X_CURRENT_LIMIT=140
25+
-D RADIO_CLASS=CustomSX1262
26+
-D WRAPPER_CLASS=CustomSX1262Wrapper
27+
-D LORA_TX_POWER=22
28+
-D SX126X_RX_BOOSTED_GAIN=1
29+
build_src_filter = ${esp32_base.build_src_filter}
30+
+<../variants/nibble_zero_connect>
31+
lib_deps =
32+
${esp32_base.lib_deps}
33+
adafruit/Adafruit SSD1306 @ ^2.5.13
34+
adafruit/Adafruit NeoPixel @ ^1.12.3
35+
36+
[env:nibble_zero_connect_repeater]
37+
extends = nibble_zero_connect_base
38+
build_flags =
39+
${nibble_zero_connect_base.build_flags}
40+
-D DISPLAY_CLASS=SSD1306Display
41+
-D ADVERT_NAME='"Nibble Repeater"'
42+
-D ADVERT_LAT=0.0
43+
-D ADVERT_LON=0.0
44+
-D ADMIN_PASSWORD='"password"'
45+
-D MAX_NEIGHBOURS=50
46+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
47+
+<helpers/ui/SSD1306Display.cpp>
48+
+<../examples/simple_repeater>
49+
lib_deps =
50+
${nibble_zero_connect_base.lib_deps}
51+
${esp32_ota.lib_deps}
52+
53+
[env:nibble_zero_connect_repeater_bridge_espnow]
54+
extends = nibble_zero_connect_base
55+
build_flags =
56+
${nibble_zero_connect_base.build_flags}
57+
-D DISPLAY_CLASS=SSD1306Display
58+
-D ADVERT_NAME='"ESPNow Bridge"'
59+
-D ADVERT_LAT=0.0
60+
-D ADVERT_LON=0.0
61+
-D ADMIN_PASSWORD='"password"'
62+
-D MAX_NEIGHBOURS=50
63+
-D WITH_ESPNOW_BRIDGE=1
64+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
65+
+<helpers/bridges/ESPNowBridge.cpp>
66+
+<helpers/ui/SSD1306Display.cpp>
67+
+<../examples/simple_repeater>
68+
lib_deps =
69+
${nibble_zero_connect_base.lib_deps}
70+
${esp32_ota.lib_deps}
71+
72+
[env:nibble_zero_connect_terminal_chat]
73+
extends = nibble_zero_connect_base
74+
build_flags =
75+
${nibble_zero_connect_base.build_flags}
76+
-D MAX_CONTACTS=300
77+
-D MAX_GROUP_CHANNELS=1
78+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
79+
+<../examples/simple_secure_chat/main.cpp>
80+
lib_deps =
81+
${nibble_zero_connect_base.lib_deps}
82+
densaugeo/base64 @ ~1.4.0
83+
84+
[env:nibble_zero_connect_room_server]
85+
extends = nibble_zero_connect_base
86+
build_flags =
87+
${nibble_zero_connect_base.build_flags}
88+
-D DISPLAY_CLASS=SSD1306Display
89+
-D ADVERT_NAME='"Nibble Room"'
90+
-D ADVERT_LAT=0.0
91+
-D ADVERT_LON=0.0
92+
-D ADMIN_PASSWORD='"password"'
93+
-D ROOM_PASSWORD='"hello"'
94+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
95+
+<helpers/ui/SSD1306Display.cpp>
96+
+<../examples/simple_room_server>
97+
lib_deps =
98+
${nibble_zero_connect_base.lib_deps}
99+
${esp32_ota.lib_deps}
100+
101+
[env:nibble_zero_connect_companion_radio_usb]
102+
extends = nibble_zero_connect_base
103+
build_flags =
104+
${nibble_zero_connect_base.build_flags}
105+
-I examples/companion_radio/ui-new
106+
-D DISPLAY_CLASS=SSD1306Display
107+
-D MAX_CONTACTS=300
108+
-D MAX_GROUP_CHANNELS=8
109+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
110+
+<helpers/ui/SSD1306Display.cpp>
111+
+<helpers/ui/MomentaryButton.cpp>
112+
+<../examples/companion_radio/*.cpp>
113+
+<../examples/companion_radio/ui-new/*.cpp>
114+
lib_deps =
115+
${nibble_zero_connect_base.lib_deps}
116+
densaugeo/base64 @ ~1.4.0
117+
118+
[env:nibble_zero_connect_companion_radio_ble]
119+
extends = nibble_zero_connect_base
120+
build_flags =
121+
${nibble_zero_connect_base.build_flags}
122+
-I examples/companion_radio/ui-new
123+
-D DISPLAY_CLASS=SSD1306Display
124+
-D MAX_CONTACTS=300
125+
-D MAX_GROUP_CHANNELS=8
126+
-D BLE_PIN_CODE=123456
127+
-D BLE_DEBUG_LOGGING=1
128+
-D OFFLINE_QUEUE_SIZE=256
129+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
130+
+<helpers/esp32/*.cpp>
131+
+<helpers/ui/SSD1306Display.cpp>
132+
+<helpers/ui/MomentaryButton.cpp>
133+
+<../examples/companion_radio/*.cpp>
134+
+<../examples/companion_radio/ui-new/*.cpp>
135+
lib_deps =
136+
${nibble_zero_connect_base.lib_deps}
137+
densaugeo/base64 @ ~1.4.0
138+
139+
[env:nibble_zero_connect_companion_radio_wifi]
140+
extends = nibble_zero_connect_base
141+
build_flags =
142+
${nibble_zero_connect_base.build_flags}
143+
-I examples/companion_radio/ui-new
144+
-D DISPLAY_CLASS=SSD1306Display
145+
-D MAX_CONTACTS=300
146+
-D MAX_GROUP_CHANNELS=8
147+
-D WIFI_DEBUG_LOGGING=1
148+
-D WIFI_SSID='"myssid"'
149+
-D WIFI_PWD='"mypwd"'
150+
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
151+
+<helpers/ui/SSD1306Display.cpp>
152+
+<helpers/ui/MomentaryButton.cpp>
153+
+<helpers/esp32/*.cpp>
154+
+<../examples/companion_radio/*.cpp>
155+
+<../examples/companion_radio/ui-new/*.cpp>
156+
lib_deps =
157+
${nibble_zero_connect_base.lib_deps}
158+
densaugeo/base64 @ ~1.4.0
159+
160+
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)