- Notifications
You must be signed in to change notification settings - Fork220
Add function to manage low power mode status#327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
dee6e34
89ea8de
ee7912e
fa5f163
cc1798a
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1481,6 +1481,11 @@ void HCIClass::dumpPkt(const char* prefix, uint8_t plen, uint8_t pdata[]) | ||
} | ||
} | ||
void HCIClass::leSetLPMode(bool status) | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
{ | ||
HCITransport.setLPMode(status); | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
} | ||
#if !defined(FAKE_HCI) | ||
HCIClass HCIObj; | ||
HCIClass& HCI = HCIObj; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -105,6 +105,8 @@ class HCIClass { | ||
virtual int leStartResolvingAddresses(); | ||
virtual int leReadPeerResolvableAddress(uint8_t peerAddressType, uint8_t* peerIdentityAddress, uint8_t* peerResolvableAddress); | ||
virtual void leSetLPMode(bool status); | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
virtual void readStoredLKs(); | ||
virtual int readStoredLK(uint8_t BD_ADDR[], uint8_t read_all = 0); | ||
virtual void writeLK(uint8_t peerAddress[], uint8_t LK[]); | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -54,6 +54,7 @@ | ||
#endif | ||
extern BLE_NAMESPACE::CordioHCIDriver& ble_cordio_get_hci_driver(); | ||
extern void ble_cordio_set_lp_mode(bool status); | ||
namespace BLE_NAMESPACE { | ||
struct CordioHCIHook { | ||
@@ -68,6 +69,10 @@ namespace BLE_NAMESPACE { | ||
static void setDataReceivedHandler(void (*handler)(uint8_t*, uint8_t)) { | ||
getTransportDriver().set_data_received_handler(handler); | ||
} | ||
static void setLowPowerMode(bool status) { | ||
ble_cordio_set_lp_mode(status); | ||
} | ||
}; | ||
} | ||
@@ -309,4 +314,9 @@ void HCICordioTransportClass::onDataReceived(uint8_t* data, uint8_t len) | ||
HCICordioTransport.handleRxData(data, len); | ||
} | ||
void HCICordioTransportClass::setLPMode(bool status) | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
{ | ||
CordioHCIHook::setLowPowerMode(status); | ||
} | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -42,6 +42,8 @@ class HCICordioTransportClass : public HCITransportInterface { | ||
virtual size_t write(const uint8_t* data, size_t length); | ||
virtual void setLPMode(bool status); | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
private: | ||
static void onDataReceived(uint8_t* data, uint8_t len); | ||
void handleRxData(uint8_t* data, uint8_t len); | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -34,6 +34,8 @@ class HCITransportInterface { | ||
virtual int read() = 0; | ||
virtual size_t write(const uint8_t* data, size_t length) = 0; | ||
virtual void setLPMode(bool status); | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
}; | ||
extern HCITransportInterface& HCITransport; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -97,6 +97,11 @@ size_t HCIUartTransportClass::write(const uint8_t* data, size_t length) | ||
return result; | ||
} | ||
void HCIUartTransportClass::setLPMode(bool status) | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
{ | ||
(void)status; | ||
} | ||
#if defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_NANO_RP2040_CONNECT) | ||
HCIUartTransportClass HCIUartTransport(SerialHCI, 119600); | ||
#else | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -38,6 +38,8 @@ class HCIUartTransportClass : public HCITransportInterface { | ||
virtual size_t write(const uint8_t* data, size_t length); | ||
virtual void setLPMode(bool status); | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
private: | ||
HardwareSerial* _uart; | ||
unsigned long _baudrate; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -135,6 +135,11 @@ size_t HCIVirtualTransportClass::write(const uint8_t* data, size_t length) | ||
return result; | ||
} | ||
void HCIVirtualTransportClass::setLPMode(bool status) | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
{ | ||
(void)status; | ||
} | ||
HCIVirtualTransportClass HCIVirtualTransport; | ||
HCITransportInterface& HCITransport = HCIVirtualTransport; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -47,4 +47,6 @@ class HCIVirtualTransportClass : public HCITransportInterface { | ||
virtual int read(); | ||
virtual size_t write(const uint8_t* data, size_t length); | ||
virtual void setLPMode(bool status); | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -105,6 +105,11 @@ size_t HCIVirtualTransportATClass::write(const uint8_t* data, size_t length) | ||
return 0; | ||
} | ||
void HCIVirtualTransportATClass::setLPMode(bool status) | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
{ | ||
(void)status; | ||
} | ||
HCIVirtualTransportATClass HCIVirtualTransportAT; | ||
HCITransportInterface& HCITransport = HCIVirtualTransportAT; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -39,4 +39,6 @@ class HCIVirtualTransportATClass : public HCITransportInterface { | ||
virtual int read(); | ||
virtual size_t write(const uint8_t* data, size_t length); | ||
virtual void setLPMode(bool status); | ||
leonardocavagnis marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
}; |