4 #define BT_RST_PIN BIT3
5 #define BT_RST_PSEL P10SEL
6 #define BT_RST_POUT P10OUT
7 #define BT_RST_PDIR P10DIR
9 #define BT_IO_PSEL P1SEL
10 #define BT_IO_RTS BIT0
11 #define BT_IO_CTS BIT3
12 #define BT_IO_POUT P1OUT
13 #define BT_IO_PIN P1IN
14 #define BT_IO_PDIR P1DIR
15 #define BT_IO_REN P1REN
17 #define BT_IO_PIN1 BIT5
18 #define BT_IO_PIN2 BIT6
19 #define BT_IO_CLKREQ BIT4
21 #define BT_SHUTDOWN() { BT_RST_POUT &= ~BT_RST_PIN; }
22 #define BT_ENABLE() { BT_RST_POUT |= BT_RST_PIN; }
24 #define BT_UART_PSEL P5SEL
25 #define BT_UART_PDIR P5DIR
26 #define BT_UART_REN P5REN
27 #define BT_UART_POUT P5OUT
28 #define BT_UART_TX_PIN BIT6
29 #define BT_UART_RX_PIN BIT7
31 #define CONFIG_BT_PINS() { \
32 BT_RST_PSEL &= ~BT_RST_PIN; \
33 BT_RST_PDIR |= BT_RST_PIN; \
35 BT_IO_PSEL &= ~(BT_IO_RTS | BT_IO_CTS | BT_IO_PIN1 | BT_IO_PIN2 | BT_IO_CLKREQ); \
36 BT_IO_PDIR &= ~(BT_IO_RTS | BT_IO_CTS | BT_IO_PIN1 | BT_IO_PIN2 | BT_IO_CLKREQ); \
37 BT_IO_POUT &= ~(BT_IO_RTS | BT_IO_CTS | BT_IO_PIN1 | BT_IO_PIN2 | BT_IO_CLKREQ); \
38 BT_UART_PSEL &= ~(BT_UART_TX_PIN | BT_UART_RX_PIN); \
39 BT_UART_PDIR &= ~(BT_UART_TX_PIN | BT_UART_RX_PIN); \
40 BT_UART_REN |= BT_UART_TX_PIN | BT_UART_RX_PIN; \
41 BT_UART_POUT |= BT_UART_TX_PIN | BT_UART_RX_PIN; \
44 void mw_enable_bt(void);
45 void mw_disable_bt(void);
55 #define BT_MW_DEVICE_CLASS 0x842704 /* Limited discovery, Rendering, Information, Wearable, Wrist Watch */
56 #define BT_RX_MAX_SIZE 255
58 void mw_init_bt_uart(const bt_uart_baud_t baud);
60 int mw_bt_uart_tx(const void *buf, const unsigned int len);
61 // extern char BT_UART_RX_CHAR;
63 int mw_bt_get_rxbuf_len(void);
64 const unsigned char *mw_bt_get_rx_buf(unsigned char **rpos, unsigned char *len);
65 unsigned char bt_feed_packet_data(unsigned char pdata);
66 uint8_t mw_bt_is_enabled(void);