Skip to content

Commit

Permalink
modified BluetoothWaterLamp
Browse files Browse the repository at this point in the history
  • Loading branch information
lwjobs committed Mar 8, 2020
1 parent c63457b commit 4313f3a
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 6 deletions.
Empty file.
12 changes: 8 additions & 4 deletions BluetoothWaterLamp/AndroidCode/SmartWaterLamp/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file removed BluetoothWaterLamp/MCUCode/.keep
Empty file.
51 changes: 51 additions & 0 deletions BluetoothWaterLamp/MCUCode/STM32/HALexample.c
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);
}
}
4 changes: 3 additions & 1 deletion BluetoothWaterLamp/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
本项目单片机部分采用的蓝牙模块是HC系列的串口蓝牙模块,其他蓝牙模块未测试,其他模块如有问题,欢迎提出,我们尽量解决
本项目单片机部分采用的蓝牙模块是HC系列的串口蓝牙模块,其他蓝牙模块未测试,其他模块如有问题,欢迎提出,我们尽量解决

单片机部分主要完成串口收发,解析串口收到的字符串,执行相应的操作

0 comments on commit 4313f3a

Please sign in to comment.