@@ -31,7 +31,7 @@ namespace cypress_ble {
31
31
32
32
using namespace std ::chrono_literals;
33
33
34
- 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) :
34
+ CyH4TransportDriver::CyH4TransportDriver (PinName tx, PinName rx, PinName cts, PinName rts, PinName bt_power_name, int baud, PinName bt_host_wake_name, PinName bt_device_wake_name, uint8_t host_wake_irq, uint8_t dev_wake_irq) :
35
35
cts (cts), rts(rts),
36
36
tx (tx), rx(rx),
37
37
bt_host_wake_name (bt_host_wake_name),
@@ -40,21 +40,21 @@ CyH4TransportDriver::CyH4TransportDriver(PinName tx, PinName rx, PinName cts, Pi
40
40
bt_device_wake (bt_device_wake_name, PIN_OUTPUT, PullNone, 1 ),
41
41
host_wake_irq_event (host_wake_irq),
42
42
dev_wake_irq_event (dev_wake_irq),
43
- bt_power (CYBSP_BT_POWER , PIN_OUTPUT, PullNone, 0 )
43
+ bt_power (bt_power_name , PIN_OUTPUT, PullNone, 0 )
44
44
{
45
45
enabled_powersave = true ;
46
46
bt_host_wake_active = false ;
47
47
}
48
48
49
- CyH4TransportDriver::CyH4TransportDriver (PinName tx, PinName rx, PinName cts, PinName rts, int baud) :
49
+ CyH4TransportDriver::CyH4TransportDriver (PinName tx, PinName rx, PinName cts, PinName rts, PinName bt_power_name, int baud) :
50
50
cts (cts),
51
51
rts (rts),
52
52
tx (tx), rx(rx),
53
53
bt_host_wake_name (NC),
54
54
bt_device_wake_name (NC),
55
55
bt_host_wake (bt_host_wake_name),
56
56
bt_device_wake (bt_device_wake_name),
57
- bt_power (CYBSP_BT_POWER , PIN_OUTPUT, PullNone, 0 )
57
+ bt_power (bt_power_name , PIN_OUTPUT, PullNone, 0 )
58
58
{
59
59
enabled_powersave = false ;
60
60
bt_host_wake_active = false ;
@@ -169,11 +169,6 @@ void CyH4TransportDriver::terminate()
169
169
false
170
170
);
171
171
172
- // DigitalInOut does not appear to have Destructor nor does it have a
173
- // free() func (though the protected gpio_t does) so must call directly
174
- // into cyhal
175
- if (CYBSP_BT_DEVICE_WAKE != NC) cyhal_gpio_free (CYBSP_BT_DEVICE_WAKE);
176
-
177
172
if (bt_host_wake.is_connected ())
178
173
{
179
174
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
@@ -182,6 +177,8 @@ void CyH4TransportDriver::terminate()
182
177
bt_host_wake = false ;
183
178
}
184
179
180
+ deassert_bt_dev_wake ();
181
+
185
182
bt_power = 0 ; // BT_POWER is an output, should not be freed only set inactive
186
183
187
184
cyhal_uart_free (&uart);
@@ -265,14 +262,14 @@ ble::vendor::cypress_ble::CyH4TransportDriver& ble_cordio_get_default_h4_transpo
265
262
#if (defined(CYBSP_BT_HOST_WAKE) && defined(CYBSP_BT_DEVICE_WAKE))
266
263
static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver (
267
264
/* TX */ CYBSP_BT_UART_TX, /* RX */ CYBSP_BT_UART_RX,
268
- /* cts */ CYBSP_BT_UART_CTS, /* rts */ CYBSP_BT_UART_RTS, DEF_BT_BAUD_RATE,
265
+ /* cts */ CYBSP_BT_UART_CTS, /* rts */ CYBSP_BT_UART_RTS, CYBSP_BT_POWER, DEF_BT_BAUD_RATE,
269
266
CYBSP_BT_HOST_WAKE, CYBSP_BT_DEVICE_WAKE
270
267
);
271
268
272
269
#else
273
270
static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver (
274
271
/* TX */ CYBSP_BT_UART_TX, /* RX */ CYBSP_BT_UART_RX,
275
- /* cts */ CYBSP_BT_UART_CTS, /* rts */ CYBSP_BT_UART_RTS, DEF_BT_BAUD_RATE);
272
+ /* cts */ CYBSP_BT_UART_CTS, /* rts */ CYBSP_BT_UART_RTS, CYBSP_BT_POWER, DEF_BT_BAUD_RATE);
276
273
#endif
277
274
return s_transport_driver;
278
275
}
0 commit comments