mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
Merge branch 'dev' into dev
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include "nrf_gpio.h"
|
||||
|
||||
#include "RAK4631Board.h"
|
||||
|
||||
#ifdef ETHERNET_ENABLED
|
||||
// Drive WB_IO2 HIGH as early as possible using direct register access.
|
||||
// WB_IO2 (P1.02, Arduino pin 34) controls the WisBlock slot power switch.
|
||||
// With POE through RAK13800, this must be enabled before the framework
|
||||
// initializes or the board will brownout from insufficient power delivery.
|
||||
// Priority 102 runs just after SystemInit.
|
||||
static void __attribute__((constructor(102))) rak4631_early_poe_power() {
|
||||
nrf_gpio_cfg_output(NRF_GPIO_PIN_MAP(1, 2)); // WB_IO2 = P1.02
|
||||
nrf_gpio_pin_set(NRF_GPIO_PIN_MAP(1, 2));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NRF52_POWER_MANAGEMENT
|
||||
// Static configuration for power management
|
||||
// Values set in variant.h defines
|
||||
@@ -36,6 +49,7 @@ void RAK4631Board::begin() {
|
||||
pinMode(PIN_USER_BTN_ANA, INPUT_PULLUP);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
Import('env')
|
||||
import os
|
||||
|
||||
# Bosch has a goof in their PlatformIO packaging making linking fail.
|
||||
# The BSEC library's extra_script.py selects cortex-m4/libalgobsec.a (soft-float ABI).
|
||||
# nRF52840 compiles with -mfloat-abi=hard, requiring the fpv4-sp-d16-hard blob.
|
||||
# Workaround to prepend the hard-float path so the linker finds it before the
|
||||
# soft-float one.
|
||||
bsec_hard = os.path.join(
|
||||
env.subst('$PROJECT_DIR'),
|
||||
'.pio', 'libdeps', env.subst('$PIOENV'),
|
||||
'BSEC Software Library', 'src',
|
||||
'cortex-m4', 'fpv4-sp-d16-hard'
|
||||
)
|
||||
env.Prepend(LIBPATH=[bsec_hard])
|
||||
@@ -2,6 +2,8 @@
|
||||
extends = nrf52_base
|
||||
board = rak4631
|
||||
board_check = true
|
||||
extra_scripts = ${nrf52_base.extra_scripts}
|
||||
post:variants/rak4631/fix_bsec_lib.py
|
||||
build_flags = ${nrf52_base.build_flags}
|
||||
${sensor_base.build_flags}
|
||||
-I variants/rak4631
|
||||
@@ -20,6 +22,8 @@ build_flags = ${nrf52_base.build_flags}
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
-D ENV_INCLUDE_RAK12035=1
|
||||
-UENV_INCLUDE_BME680
|
||||
-D ENV_INCLUDE_BME680_BSEC=1
|
||||
build_src_filter = ${nrf52_base.build_src_filter}
|
||||
+<../variants/rak4631>
|
||||
+<helpers/sensors>
|
||||
@@ -30,6 +34,7 @@ lib_deps =
|
||||
${sensor_base.lib_deps}
|
||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
||||
sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.27
|
||||
boschsensortec/BSEC Software Library @ ^1.8.1492
|
||||
|
||||
[env:RAK_4631_repeater]
|
||||
extends = rak4631
|
||||
@@ -47,6 +52,25 @@ build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
|
||||
[env:RAK_4631_repeater_ethernet]
|
||||
extends = rak4631
|
||||
build_flags =
|
||||
${rak4631.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D ADVERT_NAME='"RAK4631 Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
-D ETHERNET_ENABLED=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${rak4631.lib_deps}
|
||||
https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip
|
||||
|
||||
[env:RAK_4631_repeater_bridge_rs232_serial1]
|
||||
extends = rak4631
|
||||
build_flags =
|
||||
@@ -109,6 +133,25 @@ build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_room_server>
|
||||
|
||||
[env:RAK_4631_room_server_ethernet]
|
||||
extends = rak4631
|
||||
build_flags =
|
||||
${rak4631.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D ADVERT_NAME='"RAK4631 Room Server"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
-D ETHERNET_ENABLED=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_room_server>
|
||||
lib_deps =
|
||||
${rak4631.lib_deps}
|
||||
https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip
|
||||
|
||||
[env:RAK_4631_companion_radio_usb]
|
||||
extends = rak4631
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
@@ -121,6 +164,7 @@ build_flags =
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D ENABLE_USB_INTERFACE
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
@@ -130,6 +174,38 @@ lib_deps =
|
||||
${rak4631.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
|
||||
[env:RAK_4631_companion_radio_ethernet]
|
||||
extends = rak4631
|
||||
board_build.ldscript = boards/nrf52840_s140_v6.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_unflags =
|
||||
-D EXTRAFS=1
|
||||
build_flags =
|
||||
${rak4631.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D PIN_USER_BTN=9
|
||||
-D PIN_USER_BTN_ANA=31
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D ETHERNET_ENABLED=1
|
||||
-D ETHERNET_USE_RAK13800
|
||||
-D ETHERNET_CLASS=RAK13800EthernetInterface
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
; -D ETHERNET_DEBUG_LOGGING=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
+<helpers/ethernet/*.cpp>
|
||||
+<helpers/ethernet/RAK13800/>
|
||||
lib_deps =
|
||||
${rak4631.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip
|
||||
|
||||
|
||||
[env:RAK_4631_companion_radio_ble]
|
||||
extends = rak4631
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
@@ -181,7 +257,7 @@ build_flags =
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
-D MESH_DEBUG=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_sensor>
|
||||
@@ -193,4 +269,4 @@ build_flags =
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<../examples/kiss_modem/>
|
||||
lib_deps =
|
||||
${rak4631.lib_deps}
|
||||
${rak4631.lib_deps}
|
||||
|
||||
@@ -37,23 +37,7 @@ bool radio_init() {
|
||||
return radio.std_init(&SPI);
|
||||
}
|
||||
|
||||
uint32_t radio_get_rng_seed() {
|
||||
return radio.random(0x7FFFFFFF);
|
||||
}
|
||||
|
||||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) {
|
||||
radio.setFrequency(freq);
|
||||
radio.setSpreadingFactor(sf);
|
||||
radio.setBandwidth(bw);
|
||||
radio.setCodingRate(cr);
|
||||
}
|
||||
|
||||
void radio_set_tx_power(int8_t dbm) {
|
||||
radio.setOutputPower(dbm);
|
||||
}
|
||||
|
||||
mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,5 @@ extern AutoDiscoverRTCClock rtc_clock;
|
||||
extern EnvironmentSensorManager sensors;
|
||||
|
||||
bool radio_init();
|
||||
uint32_t radio_get_rng_seed();
|
||||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
|
||||
void radio_set_tx_power(int8_t dbm);
|
||||
mesh::LocalIdentity radio_new_identity();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user