-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
Empty file.
12 changes: 8 additions & 4 deletions
12
BluetoothWaterLamp/AndroidCode/SmartWaterLamp/.idea/gradle.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* 函数功能: 串口接收完成回调函数 | ||
* 输入参数: 无 | ||
* 返 回 值: 无 | ||
* 说 明:无 | ||
*/ | ||
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle) | ||
{ | ||
if(UartHandle==&husart2) | ||
{ | ||
uartbuff[readcount] = aRxBuffer[1]; | ||
readcount ++; | ||
if(readcount >=16) | ||
{ | ||
readcount = 0; | ||
} | ||
uint8_t tt = Str_Search((char*)uartbuff,"ON"); | ||
if(tt==1){ | ||
flag = 1; | ||
memset(uartbuff,0,16); | ||
strcpy(uartbuff,""); | ||
readcount = 0; | ||
} | ||
uint8_t tt1 = Str_Search((char*)uartbuff,"OFF"); | ||
if(tt1==1){ | ||
flag = 0; | ||
memset(uartbuff,0,16); | ||
//strcpy(uartbuff,""); | ||
readcount = 0; | ||
} | ||
|
||
uint8_t tt2 = Str_Search((char*)uartbuff,"THEME1"); | ||
if(tt2==1){ | ||
flag = 2; | ||
memset(uartbuff,0,16); | ||
//strcpy(uartbuff,""); | ||
readcount = 0; | ||
} | ||
|
||
uint8_t tt3 = Str_Search((char*)uartbuff,"THEME2"); | ||
if(tt3==1){ | ||
flag = 3; | ||
memset(uartbuff,0,16); | ||
//strcpy(uartbuff,""); | ||
readcount = 0; | ||
} | ||
|
||
HAL_UART_Transmit(&husart2,&aRxBuffer[1],1,0); | ||
HAL_UART_Receive_IT(&husart2,&aRxBuffer[1],1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
本项目单片机部分采用的蓝牙模块是HC系列的串口蓝牙模块,其他蓝牙模块未测试,其他模块如有问题,欢迎提出,我们尽量解决 | ||
本项目单片机部分采用的蓝牙模块是HC系列的串口蓝牙模块,其他蓝牙模块未测试,其他模块如有问题,欢迎提出,我们尽量解决 | ||
|
||
单片机部分主要完成串口收发,解析串口收到的字符串,执行相应的操作 |