state = HCI_PACKET_START;
// disable BT UART?
// mabye UCA1CTL1 = UCSWRST ?
+
pdata = EHCILL_GO_TO_SLEEP_ACK;
mw_bt_uart_tx(&pdata, 0x01);
- BT_IO_POUT |= BT_IO_RTS; // pull RTS -> stop data
+ // pull RTS -> stop data
+ BT_IO_POUT |= BT_IO_RTS;
+
+ // enable IRQ on CTS
P1IFG &= ~BT_IO_CTS;
P1IE |= BT_IO_CTS;
{
bt_hci_cmd_t packet;
+ // refuse any HCI if interface is not enabled
+ if (mw_bt_is_enabled() == 0)
+ return;
+
if (state == EHCILL_SLEEPING) {
uint8_t ehcill_p = EHCILL_WAKE_UP_IND;
- debug_uart_tx("HCILL wakeup\n");
+ debug_uart_tx("wakeup HCILL\n");
state = HCI_PACKET_START;
mw_bt_uart_tx(&ehcill_p, 1);
__delay_cycles(300000);
{
bt_hci_acl_t packet;
+ // refuse any HCI if interface is not enabled
+ if (mw_bt_is_enabled() == 0)
+ return;
+
packet.type = HCI_ACL_DATA_PACKET;
packet.handle = handle | ((PB & 0x03) << 12) | ((BC & 0x03) << 14);
packet.total_length = dlen + 4;
void bt_hci_ehcill_wake(void)
{
- uint8_t ehcill_p = EHCILL_WAKE_UP_ACK;
+ const uint8_t ehcill_p = EHCILL_WAKE_UP_ACK;
debug_uart_tx("HCILL wakeup\n");
P1IE &= ~BT_IO_CTS;
+ P1IFG &= ~BT_IO_CTS;
state = HCI_PACKET_START;
BT_IO_POUT &= ~BT_IO_RTS; // drop RTS -> start data