RP2040: Enable ExternalNotification and RangeTest Module, set randomSeed (#2664)

* Enable ExternalNotification (and RangeTest) Module

* Set a random seed at boot
pull/2660/head^2
GUVWAF 2023-07-29 14:19:58 +02:00 zatwierdzone przez GitHub
rodzic 3d697f8cf4
commit ffcc1a0275
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
6 zmienionych plików z 19 dodań i 4 usunięć

Wyświetl plik

@ -458,6 +458,11 @@ void setup()
#ifdef ARCH_NRF52
nrf52Setup();
#endif
#ifdef ARCH_RP2040
rp2040Setup();
#endif
// We do this as early as possible because this loads preferences from flash
// but we need to do this after main cpu iniot (esp32setup), because we need the random seed set
nodeDB.init();

Wyświetl plik

@ -68,7 +68,7 @@ extern uint32_t serialSinceMsec;
// This will suppress the current delay and instead try to run ASAP.
extern bool runASAP;
void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), clearBonds();
void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), rp2040Setup(), clearBonds();
meshtastic_DeviceMetadata getDeviceMetadata();

Wyświetl plik

@ -24,7 +24,7 @@
#include "modules/esp32/AudioModule.h"
#include "modules/esp32/StoreForwardModule.h"
#endif
#if defined(ARCH_ESP32) || defined(ARCH_NRF52)
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
#include "modules/ExternalNotificationModule.h"
#include "modules/RangeTestModule.h"
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(CONFIG_IDF_TARGET_ESP32S2)
@ -81,7 +81,7 @@ void setupModules()
storeForwardModule = new StoreForwardModule();
#endif
#if defined(ARCH_ESP32) || defined(ARCH_NRF52)
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
externalNotificationModule = new ExternalNotificationModule();
new RangeTestModule();
#endif
@ -92,4 +92,4 @@ void setupModules()
// NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra
// acks
routingModule = new RoutingModule();
}
}

Wyświetl plik

@ -27,4 +27,12 @@ void getMacAddr(uint8_t *dmac)
dmac[2] = src.id[4];
dmac[1] = src.id[3];
dmac[0] = src.id[2];
}
void rp2040Setup()
{
/* Sets a random seed to make sure we get different random numbers on each boot.
Taken from CPU cycle counter and ROSC oscillator, so should be pretty random.
*/
randomSeed(rp2040.hwrand32());
}

Wyświetl plik

@ -19,6 +19,7 @@
// SDA = 4
// SCL = 5
#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 17
#define LED_PIN PIN_LED

Wyświetl plik

@ -19,6 +19,7 @@
// SDA = 4
// SCL = 5
#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 17
#define BATTERY_PIN 26