@@ -126,9 +126,10 @@ void CyH4TransportDriver::initialize()
126
126
sleep_manager_lock_deep_sleep ();
127
127
128
128
cyhal_gpio_write (CYBSP_BT_POWER, 0 );
129
- rtos::ThisThread::sleep_for (20ms );
129
+ rtos::ThisThread::sleep_for (1ms );
130
130
131
- cyhal_uart_init (&uart, tx, rx, NULL , NULL );
131
+ cy_rslt_t rslt = cyhal_uart_init (&uart, tx, rx, NULL , NULL );
132
+ // MBED_WARNING
132
133
133
134
const cyhal_uart_cfg_t uart_cfg = { .data_bits = 8 , .stop_bits = 1 , .parity = CYHAL_UART_PARITY_NONE, .rx_buffer = NULL , .rx_buffer_size = 0 };
134
135
cyhal_uart_configure (&uart, &uart_cfg);
@@ -138,7 +139,6 @@ void CyH4TransportDriver::initialize()
138
139
cyhal_uart_enable_event (&uart, CYHAL_UART_IRQ_RX_NOT_EMPTY, CYHAL_ISR_PRIORITY_DEFAULT, true );
139
140
140
141
cyhal_gpio_write (CYBSP_BT_POWER, 1 );
141
- rtos::ThisThread::sleep_for (10ms);
142
142
143
143
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
144
144
if (bt_host_wake_name != NC) {
@@ -156,7 +156,7 @@ void CyH4TransportDriver::initialize()
156
156
bt_device_wake = WAKE_EVENT_ACTIVE_HIGH;
157
157
}
158
158
sleep_manager_unlock_deep_sleep ();
159
- rtos::ThisThread::sleep_for (500ms);
159
+ // rtos::ThisThread::sleep_for(500ms);
160
160
}
161
161
162
162
void CyH4TransportDriver::terminate ()
@@ -178,13 +178,9 @@ void CyH4TransportDriver::terminate()
178
178
179
179
if (CYBSP_BT_DEVICE_WAKE != NC) cyhal_gpio_free (CYBSP_BT_DEVICE_WAKE);
180
180
181
-
182
181
if (CYBSP_BT_HOST_WAKE != NC) cyhal_gpio_write (CYBSP_BT_DEVICE_WAKE, false );
183
182
184
- if (CYBSP_BT_POWER != NC)
185
- {
186
- cyhal_gpio_write (CYBSP_BT_POWER, false );
187
- }
183
+ if (CYBSP_BT_POWER != NC) cyhal_gpio_write (CYBSP_BT_POWER, false ); // BT_POWER is an output, should not be freed only set inactive
188
184
189
185
cyhal_uart_free (&uart);
190
186
}
0 commit comments