RAK4631 is almost feature complete

This commit is contained in:
Kevin Hester
2021-04-12 13:25:55 +08:00
parent 7224782d23
commit 55b38a7b02
7 changed files with 36 additions and 41 deletions

View File

@@ -409,6 +409,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define HW_VENDOR HardwareModel_PPR
#elif defined(RAK4630)
#define HW_VENDOR HardwareModel_RAK4631
#elif NRF52_SERIES
#define HW_VENDOR HardwareModel_NRF52_UNKNOWN

View File

@@ -427,11 +427,12 @@ void setup()
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
#ifdef GENIEBLOCKS
I'm intentionally breaking your build so you see this note. Feel free to revert if not correct. I think you can
removed this code by instead defining PIN_GPS_RESET and use the shared code in GPS.cpp instead.
Im intentionally breaking your build so you see this note.Feel free to revert if not correct.I think you can
remove this GPS_RESET_N code by instead defining PIN_GPS_RESET and
use the shared code in GPS.cpp instead.- geeksville
// gps setup
pinMode(GPS_RESET_N, OUTPUT);
// gps setup
pinMode(GPS_RESET_N, OUTPUT);
pinMode(GPS_EXTINT, OUTPUT);
digitalWrite(GPS_RESET_N, HIGH);
digitalWrite(GPS_EXTINT, LOW);

View File

@@ -21,6 +21,7 @@ typedef enum _HardwareModel {
HardwareModel_TBEAM0p7 = 6,
HardwareModel_T_ECHO = 7,
HardwareModel_TLORA_V1_1p3 = 8,
HardwareModel_RAK4631 = 9,
HardwareModel_LORA_RELAY_V1 = 32,
HardwareModel_NRF52840DK = 33,
HardwareModel_PPR = 34,

View File

@@ -44,10 +44,23 @@ void getMacAddr(uint8_t *dmac)
}
}
static void initBrownout()
{
auto vccthresh = POWER_POFCON_THRESHOLD_V17;
auto err_code = sd_power_pof_enable(POWER_POFCON_POF_Enabled);
assert(err_code == NRF_SUCCESS);
err_code = sd_power_pof_threshold_set(vccthresh);
assert(err_code == NRF_SUCCESS);
// We don't bother with setting up brownout if soft device is disabled - because during production we always use softdevice
}
NRF52Bluetooth *nrf52Bluetooth;
static bool bleOn = false;
static const bool useSoftDevice = false; // Set to false for easier debugging
static const bool useSoftDevice = true; // Set to false for easier debugging
void setBluetoothEnable(bool on)
{
@@ -59,6 +72,9 @@ void setBluetoothEnable(bool on)
else {
nrf52Bluetooth = new NRF52Bluetooth();
nrf52Bluetooth->setup();
// We delay brownout init until after BLE because BLE starts soft device
initBrownout();
}
}
} else {
@@ -81,20 +97,6 @@ int printf(const char *fmt, ...)
return res;
}
void initBrownout()
{
auto vccthresh = POWER_POFCON_THRESHOLD_V17;
if (useSoftDevice) {
auto err_code = sd_power_pof_enable(POWER_POFCON_POF_Enabled);
assert(err_code == NRF_SUCCESS);
err_code = sd_power_pof_threshold_set(vccthresh);
assert(err_code == NRF_SUCCESS);
}
// We don't bother with setting up brownout if soft device is disabled - because during production we always use softdevice
}
void checkSDEvents()
{
if (useSoftDevice) {
@@ -147,8 +149,6 @@ void nrf52Setup()
// randomSeed(r);
DEBUG_MSG("FIXME, call randomSeed\n");
// ::printf("TESTING PRINTF\n");
initBrownout();
}
void cpuDeepSleep(uint64_t msecToWake)