X-Git-Url: https://git.karo-electronics.de/?p=oswald.git;a=blobdiff_plain;f=metawatch%2Fbt_hci.c;fp=metawatch%2Fbt_hci.c;h=7bf74449eb8f9d8fe1f85d846241abf2f9e71ac1;hp=838aafc20aeda695b183f038bfb3d36920e1c960;hb=1b5790095c23913d02531727e47b79af3568e0b1;hpb=3e320aaa4175a0ed469581f1dea2eac35b390878 diff --git a/metawatch/bt_hci.c b/metawatch/bt_hci.c index 838aafc..7bf7444 100644 --- a/metawatch/bt_hci.c +++ b/metawatch/bt_hci.c @@ -327,10 +327,14 @@ unsigned char bt_feed_packet_data(unsigned char pdata) 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; @@ -421,7 +425,7 @@ void bt_hci_cmd(const uint8_t OGF, const uint8_t OCF, const uint8_t data_len, co 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); @@ -484,11 +488,12 @@ void bt_hci_init(void) 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