Skip to content

Commit dbc006b

Browse files
fix ble drivers
1 parent 72b7d97 commit dbc006b

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

connectivity/drivers/ble/COMPONENT_CYW43XXX/CyH4TransportDriver.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@
1818
#if DEVICE_SERIAL && DEVICE_SERIAL_FC
1919

2020
#include "CyH4TransportDriver.h"
21+
#include "mbed_power_mgmt.h"
22+
#include "drivers/InterruptIn.h"
23+
#include "cybsp_types.h"
24+
#include "Callback.h"
25+
#include "rtos/ThisThread.h"
26+
#include <chrono>
2127

2228
namespace ble {
2329
namespace vendor {
2430
namespace cypress_ble {
2531

32+
using namespace std::chrono_literals;
2633

2734
CyH4TransportDriver::CyH4TransportDriver(PinName tx, PinName rx, PinName cts, PinName rts, int baud, PinName bt_host_wake_name, PinName bt_device_wake_name, uint8_t host_wake_irq, uint8_t dev_wake_irq) :
2835
cts(cts), rts(rts),
@@ -112,7 +119,7 @@ static void on_controller_irq(void *callback_arg, cyhal_uart_event_t event)
112119
void CyH4TransportDriver::initialize()
113120
{
114121
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
115-
InterruptIn *host_wake_pin;
122+
mbed::InterruptIn *host_wake_pin;
116123
#endif
117124

118125
sleep_manager_lock_deep_sleep();
@@ -126,9 +133,9 @@ void CyH4TransportDriver::initialize()
126133
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
127134
if (bt_host_wake_name != NC) {
128135
//Register IRQ for Host WAKE
129-
host_wake_pin = new InterruptIn(bt_host_wake_name);
130-
host_wake_pin->fall(callback(this, &CyH4TransportDriver::bt_host_wake_fall_irq_handler));
131-
host_wake_pin->rise(callback(this, &CyH4TransportDriver::bt_host_wake_rise_irq_handler));
136+
host_wake_pin = new mbed::InterruptIn(bt_host_wake_name);
137+
host_wake_pin->fall(mbed::callback(this, &CyH4TransportDriver::bt_host_wake_fall_irq_handler));
138+
host_wake_pin->rise(mbed::callback(this, &CyH4TransportDriver::bt_host_wake_rise_irq_handler));
132139
}
133140
#endif
134141
if (dev_wake_irq_event == WAKE_EVENT_ACTIVE_LOW) {

connectivity/drivers/ble/COMPONENT_CYW43XXX/CyH4TransportDriver.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#if (DEVICE_SERIAL && DEVICE_SERIAL_FC) || defined(DOXYGEN_ONLY)
2222

2323
#include <stdint.h>
24-
#include "mbed.h"
2524
#include "CordioHCITransportDriver.h"
2625
#include "drivers/DigitalInOut.h"
26+
#include "cyhal_uart.h"
2727

2828
namespace ble {
2929
namespace vendor {
@@ -88,15 +88,15 @@ class CyH4TransportDriver : public CordioHCITransportDriver {
8888
// However UART APIs does not prevent the BT radio from going to sleep.
8989
// Use the HAL APIs to prevent the radio from going to sleep until UART transmition is complete.
9090
// Mbed layer has no API that distinguish between data in HW buffer v.s. data already transmitted.
91-
91+
9292
cyhal_uart_t uart;
9393
PinName cts;
9494
PinName rts;
9595
PinName bt_host_wake_name;
9696
PinName bt_device_wake_name;
9797

98-
DigitalInOut bt_host_wake;
99-
DigitalInOut bt_device_wake;
98+
mbed::DigitalInOut bt_host_wake;
99+
mbed::DigitalInOut bt_device_wake;
100100
bool bt_host_wake_active;
101101

102102
bool enabled_powersave;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "cordio-cyw43xxx"
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "cordio-cy8c63xx"
3+
}
4+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "cordio-stm32wb"
3+
}

0 commit comments

Comments
 (0)