Adding to BLE terminate method code that releases the UART and disables interrupts and GPIO

pull/14009/head^2
Keith Wheeler 2020-10-30 11:55:58 -07:00 committed by Wheeler Keith (CY CSS ICW Integration)
parent d2adc9ef78
commit bf7adcf0d2
1 changed files with 21 additions and 1 deletions

View File

@ -149,7 +149,27 @@ void CyH4TransportDriver::initialize()
rtos::ThisThread::sleep_for(500ms);
}
void CyH4TransportDriver::terminate() { }
void CyH4TransportDriver::terminate()
{
cyhal_uart_event_t enable_irq_event = (cyhal_uart_event_t)(CYHAL_UART_IRQ_RX_DONE
| CYHAL_UART_IRQ_TX_DONE
| CYHAL_UART_IRQ_RX_NOT_EMPTY
);
cyhal_uart_enable_event(&uart,
enable_irq_event,
CYHAL_ISR_PRIORITY_DEFAULT,
false
);
cyhal_uart_register_callback(&uart, NULL, NULL);
cyhal_uart_free(&uart);
cyhal_gpio_free(CYBSP_BT_DEVICE_WAKE);
cyhal_gpio_free(CYBSP_BT_HOST_WAKE);
cyhal_gpio_write(CYBSP_BT_POWER, false);
cyhal_gpio_free(CYBSP_BT_POWER);
}
uint16_t CyH4TransportDriver::write(uint8_t type, uint16_t len, uint8_t *pData)
{