Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
leonardocavagnis wants to merge5 commits intoarduino-libraries:master
base:master
Choose a base branch
Loading
fromleonardocavagnis:ble_local_lp_mode
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletionssrc/local/BLELocalDevice.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -478,6 +478,11 @@ void BLELocalDevice::noDebug()
HCI.noDebug();
}

void BLELocalDevice::setLowPowerModeEnabled(bool enabled)
{
HCI.leSetLPMode(enabled);
}

#if !defined(FAKE_BLELOCALDEVICE)
BLELocalDevice BLEObj;
BLELocalDevice& BLE = BLEObj;
Expand Down
3 changes: 3 additions & 0 deletionssrc/local/BLELocalDevice.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -107,6 +107,9 @@ class BLELocalDevice {

virtual void setDisplayCode(void (*displayCode)(uint32_t confirmationCode));
virtual void setBinaryConfirmPairing(bool (*binaryConfirmPairing)());

virtual void setLowPowerModeEnabled(bool enabled);

uint8_t BDaddress[6];

protected:
Expand Down
5 changes: 5 additions & 0 deletionssrc/utility/HCI.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1481,6 +1481,11 @@ void HCIClass::dumpPkt(const char* prefix, uint8_t plen, uint8_t pdata[])
}
}

void HCIClass::leSetLPMode(bool status)
{
HCITransport.setLPMode(status);
}

#if !defined(FAKE_HCI)
HCIClass HCIObj;
HCIClass& HCI = HCIObj;
Expand Down
2 changes: 2 additions & 0 deletionssrc/utility/HCI.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);

virtual void readStoredLKs();
virtual int readStoredLK(uint8_t BD_ADDR[], uint8_t read_all = 0);
virtual void writeLK(uint8_t peerAddress[], uint8_t LK[]);
Expand Down
10 changes: 10 additions & 0 deletionssrc/utility/HCICordioTransport.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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 {
Expand All@@ -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);
}
};
}

Expand DownExpand Up@@ -309,4 +314,9 @@ void HCICordioTransportClass::onDataReceived(uint8_t* data, uint8_t len)
HCICordioTransport.handleRxData(data, len);
}

void HCICordioTransportClass::setLPMode(bool status)
{
CordioHCIHook::setLowPowerMode(status);
}

#endif
2 changes: 2 additions & 0 deletionssrc/utility/HCICordioTransport.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,8 @@ class HCICordioTransportClass : public HCITransportInterface {

virtual size_t write(const uint8_t* data, size_t length);

virtual void setLPMode(bool status);

private:
static void onDataReceived(uint8_t* data, uint8_t len);
void handleRxData(uint8_t* data, uint8_t len);
Expand Down
2 changes: 2 additions & 0 deletionssrc/utility/HCITransport.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
};

extern HCITransportInterface& HCITransport;
Expand Down
5 changes: 5 additions & 0 deletionssrc/utility/HCIUartTransport.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -97,6 +97,11 @@ size_t HCIUartTransportClass::write(const uint8_t* data, size_t length)
return result;
}

void HCIUartTransportClass::setLPMode(bool status)
{
(void)status;
}

#if defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_NANO_RP2040_CONNECT)
HCIUartTransportClass HCIUartTransport(SerialHCI, 119600);
#else
Expand Down
2 changes: 2 additions & 0 deletionssrc/utility/HCIUartTransport.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,8 @@ class HCIUartTransportClass : public HCITransportInterface {

virtual size_t write(const uint8_t* data, size_t length);

virtual void setLPMode(bool status);

private:
HardwareSerial* _uart;
unsigned long _baudrate;
Expand Down
5 changes: 5 additions & 0 deletionssrc/utility/HCIVirtualTransport.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -135,6 +135,11 @@ size_t HCIVirtualTransportClass::write(const uint8_t* data, size_t length)
return result;
}

void HCIVirtualTransportClass::setLPMode(bool status)
{
(void)status;
}

HCIVirtualTransportClass HCIVirtualTransport;

HCITransportInterface& HCITransport = HCIVirtualTransport;
Expand Down
2 changes: 2 additions & 0 deletionssrc/utility/HCIVirtualTransport.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
};
5 changes: 5 additions & 0 deletionssrc/utility/HCIVirtualTransportAT.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -105,6 +105,11 @@ size_t HCIVirtualTransportATClass::write(const uint8_t* data, size_t length)
return 0;
}

void HCIVirtualTransportATClass::setLPMode(bool status)
{
(void)status;
}

HCIVirtualTransportATClass HCIVirtualTransportAT;

HCITransportInterface& HCITransport = HCIVirtualTransportAT;
Expand Down
2 changes: 2 additions & 0 deletionssrc/utility/HCIVirtualTransportAT.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
};

[8]ページ先頭

©2009-2025 Movatter.jp