CC2640R2F UART

来源:互联网 发布:百帝王啤酒知乎 编辑:程序博客网 时间:2024/06/08 04:32

1.首先添加库文件\ti\simplelink_cc2640r2_sdk_1_30_00_25\source\ti\blestack\npi\src 

  并添加文件路径

2.

1. 打开宏定义:NPI_USE_UART 
2. 打开宏定义:xPOWER_SAVING

3.利用API: void NPITLUART_initializeTransport(Char*tRxBuf, Char *tTxBuf, npiCB_t npiCBack) 注册你的串口,具体怎么用看函数声明

static char uart_rxbuf[128];static char uart_rxbuf[128];static void npiuart_cb(uint16 rxlen ,uint16txlen){if(rxlen>0){NPITLUART_readTranspot();memcpy(uart_txbuf,uart_rxbuf,rxlen);NPITLUART_writeTranspot(rxlen);}}

4.

在CC2640R2_LAUNCHXL.c中定义了管脚 constUARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2640R2_LAUNCHXL_UARTCOUNT] = {{.baseAddr = UART0_BASE,.powerMngrId = PowerCC26XX_PERIPH_UART0,.intNum = INT_UART0_COMB,.intPriority = ~0,.swiPriority = 0,.txPin = CC2640R2_LAUNCHXL_UART_TX,.rxPin = CC2640R2_LAUNCHXL_UART_RX,.ctsPin = PIN_UNASSIGNED,.rtsPin = PIN_UNASSIGNED}};CC2640R2_LAUNCHXL.h/* UARTBoard */#define CC2640R2_LAUNCHXL_UART_RX IOID_2 /* RXD */#define CC2640R2_LAUNCHXL_UART_TX IOID_3 /* TXD */#define CC2640R2_LAUNCHXL_UART_CTS IOID_19 /* CTS */#define CC2640R2_LAUNCHXL_UART_RTS IOID_18 /* RTS */
5.如何使用低功耗uart ,建议是4线法,即用流控的方法进行中断唤醒。还有就是参照之前的博客用SCSuart的方式。

我的QQ群:639597049