Added experimental functions allowing to set the BLE modem to sleep to save power. Does not work as intended (bug in the SDK probably).

This commit is contained in:
Th3maz1ng 2024-01-01 21:45:20 +01:00
parent 580c9f4e68
commit 8745170092
2 changed files with 28 additions and 0 deletions

View File

@ -96,3 +96,27 @@ bool is_ble_modem_on(void)
return false; return false;
return true; return true;
} }
bool ble_modem_allow_sleep(bool allowSleep)
{
tls_bt_status_t ret = tls_bt_ctrl_sleep(allowSleep);
if(TLS_BT_STATUS_SUCCESS != ret)
{
TLS_BT_APPL_TRACE_ERROR("%s, tls_bt_ctrl_sleep ret:%d"NEW_LINE, __FUNCTION__, ret);
}
return TLS_BT_STATUS_SUCCESS == ret;
}
bool ble_modem_wakeup(void)
{
tls_bt_status_t ret = tls_bt_ctrl_wakeup();
if(TLS_BT_STATUS_SUCCESS != ret)
{
TLS_BT_APPL_TRACE_ERROR("%s, tls_bt_ctrl_wakeup ret:%d"NEW_LINE, __FUNCTION__, ret);
}
return TLS_BT_STATUS_SUCCESS == ret;
}

View File

@ -29,4 +29,8 @@ bool ble_modem_off(void);
*/ */
bool is_ble_modem_on(void); bool is_ble_modem_on(void);
bool ble_modem_allow_sleep(bool allowSleep);
bool ble_modem_wakeup(void);
#endif //BLE_MODEM_H #endif //BLE_MODEM_H