|
|
@ -1,5 +1,6 @@ |
|
|
#if defined(NRF52_PLATFORM) |
|
|
#if defined(NRF52_PLATFORM) |
|
|
#include "NRF52Board.h" |
|
|
#include "NRF52Board.h" |
|
|
|
|
|
#include <target.h> |
|
|
|
|
|
|
|
|
#include <bluefruit.h> |
|
|
#include <bluefruit.h> |
|
|
#include <nrf_soc.h> |
|
|
#include <nrf_soc.h> |
|
|
@ -297,6 +298,37 @@ float NRF52Board::getMCUTemperature() { |
|
|
return temp * 0.25f; // Convert to *C
|
|
|
return temp * 0.25f; // Convert to *C
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void NRF52Board::powerOff() { |
|
|
|
|
|
// Power off the display if any
|
|
|
|
|
|
#ifdef DISPLAY_CLASS |
|
|
|
|
|
display.turnOff(); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Power off LoRa
|
|
|
|
|
|
radio_driver.powerOff(); |
|
|
|
|
|
|
|
|
|
|
|
// Keep LoRa inactive during deepsleep
|
|
|
|
|
|
digitalWrite(P_LORA_NSS, HIGH); |
|
|
|
|
|
|
|
|
|
|
|
// Power off GPS if any
|
|
|
|
|
|
if(sensors.getLocationProvider() != NULL) { |
|
|
|
|
|
sensors.getLocationProvider()->stop(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Flush serial buffers
|
|
|
|
|
|
Serial.flush(); |
|
|
|
|
|
delay(100); |
|
|
|
|
|
|
|
|
|
|
|
// Enter SYSTEMOFF
|
|
|
|
|
|
uint8_t sd_enabled = 0; |
|
|
|
|
|
sd_softdevice_is_enabled(&sd_enabled); |
|
|
|
|
|
if (sd_enabled) { // SoftDevice is enabled
|
|
|
|
|
|
sd_power_system_off(); |
|
|
|
|
|
} else { // SoftDevice is not enable
|
|
|
|
|
|
NRF_POWER->SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bool NRF52Board::getBootloaderVersion(char* out, size_t max_len) { |
|
|
bool NRF52Board::getBootloaderVersion(char* out, size_t max_len) { |
|
|
static const char BOOTLOADER_MARKER[] = "UF2 Bootloader "; |
|
|
static const char BOOTLOADER_MARKER[] = "UF2 Bootloader "; |
|
|
const uint8_t* flash = (const uint8_t*)0x000FB000; // earliest known info.txt location is 0xFB90B, latest is 0xFCC4B
|
|
|
const uint8_t* flash = (const uint8_t*)0x000FB000; // earliest known info.txt location is 0xFB90B, latest is 0xFCC4B
|
|
|
|