mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-08 10:57:51 +00:00
begin deep sleep support for nrf52
This commit is contained in:
@@ -125,6 +125,12 @@ bool RadioInterface::init()
|
||||
return true;
|
||||
}
|
||||
|
||||
int RadioInterface::notifyDeepSleepCb(void *unused)
|
||||
{
|
||||
sleep();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** hash a string into an integer
|
||||
*
|
||||
* djb2 by Dan Bernstein.
|
||||
|
||||
@@ -48,7 +48,7 @@ class RadioInterface
|
||||
CallbackObserver<RadioInterface, void *>(this, &RadioInterface::preflightSleepCb);
|
||||
|
||||
CallbackObserver<RadioInterface, void *> notifyDeepSleepObserver =
|
||||
CallbackObserver<RadioInterface, void *>(this, &RadioInterface::notifyDeepSleepDb);
|
||||
CallbackObserver<RadioInterface, void *>(this, &RadioInterface::notifyDeepSleepCb);
|
||||
|
||||
protected:
|
||||
MeshPacket *sendingPacket = NULL; // The packet we are currently sending
|
||||
@@ -136,11 +136,7 @@ class RadioInterface
|
||||
/// Return 0 if sleep is okay
|
||||
int preflightSleepCb(void *unused = NULL) { return canSleep() ? 0 : 1; }
|
||||
|
||||
int notifyDeepSleepDb(void *unused = NULL)
|
||||
{
|
||||
sleep();
|
||||
return 0;
|
||||
}
|
||||
int notifyDeepSleepCb(void *unused = NULL);
|
||||
|
||||
int reloadConfig(void *unused)
|
||||
{
|
||||
|
||||
@@ -201,9 +201,20 @@ bool SX1262Interface::isActivelyReceiving()
|
||||
|
||||
bool SX1262Interface::sleep()
|
||||
{
|
||||
DEBUG_MSG("sx1262 entering sleep mode\n");
|
||||
setStandby(); // Stop any pending operations
|
||||
|
||||
// turn off TCXO if it was powered
|
||||
// FIXME - this isn't correct
|
||||
// lora.setTCXO(0);
|
||||
|
||||
// put chipset into sleep mode
|
||||
disableInterrupt();
|
||||
lora.sleep();
|
||||
lora.sleep(false); // Note: we do not keep the config, full reinit will be needed
|
||||
|
||||
#ifdef SX1262_POWER_EN
|
||||
digitalWrite(SX1262_POWER_EN, LOW);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user