小雨 0℃ 3.10日 (八级大风)

忙碌生活:在线课程与工作间的平衡
好忙好忙,看不完的课件,看不完的在线课程,上不完的课,说真的,微信给人打声招呼都变成一种奢侈!唯一闲下来的时间估计就剩下睡觉前和起床前》这样到底为了什么。。。。。。。

好困,上床睡觉了》

#include "my_bluetooth.h" #include "main.h" //==包含需要的头文件 #include "my_xy_v17b.h" #include "my_asr01.h" #include "my_servo.h" unsigned int SystemTimer=0,SystemTimer_ms=0; //全局时间变量声明 u8 Dht11_Temp=0,Dht11_Humi=0; u8 PageNum=1,Cursor=1,isfreash=0; uint8_t str40[30]=""; u8 JInZhi=0;//0-12进制-24进制 u16 count=0; //闹钟相关 u8 naozhogn1_shi=06,naozhogn1_fen=06,IsNaoZhong1=0,IsDaoDaJiShiDian_1=0; u8 naozhogn2_shi=06,naozhogn2_fen=06,IsNaoZhong2=0,IsDaoDaJiShiDian_2=0; u8 naozhogn3_shi=06,naozhogn3_fen=06,IsNaoZhong3=0,IsDaoDaJiShiDian_3=0; //计时器先关 u8 IsStart=1; int JiShi_S=0,JiShi_Ms=0,JiShiFen=0; float JiShi=0; u8 Hour=0,Fen=0; //亮度 u8 Dim =50; void ShowDateTime(void); void ShowWeatherAfterTommorow(void); void ShowWeatherATommorow(void); /*=================================主函数===================================*/ int main(void) { delay_init(); //延时功能初始化 NVIC_Configuration(); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级 JTAGDIS_SWDENABLE(); //禁用JTAG,使能SWD LED_Init(); Usart2_Init(115200); WifiWeather_ResetIO_Init(); HMI_Init();//串口屏初始化 HMISendCMD("page page0"); KEY_Init(); while(DHT11_Init());//DHT11初始化 DS1302_init(Settime);//DS1302计时模块 //DS1302_calibration_time(25,5,8,17,55,0); GetWeather(0); TIM2_ENABLE_1S(); XY_V17B_Init(9600); //语音模块初始化 XY17B_SetVoice(10); //语音模块等级设定到最高 SendCMD(Stop,6); //停止播放 PageNum=1;isfreash=1; sprintf((char*)str40,"dim=%d",Dim); HMISendCMD((char*)str40); asr01_init(9600); Servo_TIM3_init(CH1_DISABLE,CH2_ENABLE,CH3_ENABLE,CH4_ENABLE,NoRemp);//使用定时器3的通道1 2 3产生PWM波调光 ServoSetCnt(TIM3,2,1000);//蓝色 ServoSetCnt(TIM3,3,1000);//绿色 ServoSetCnt(TIM3,4,1000);//Z左蓝 while(1) { //显示时间 delay_ms(100); DHT11_Read_Data(&Dht11_Temp,&Dht11_Humi);//获取温湿度 /*=================================调用串口屏显示数据=================================*/ if(PageNum==1) { sprintf((char*)str40,"t2.txt=\"%d℃\"",Dht11_Temp); HMISendCMD((char*)str40);//温度 sprintf((char*)str40,"t3.txt=\"%d%\"",Dht11_Humi); HMISendCMD((char*)str40);//湿度 ShowWeatherAfterTommorow();//显示天气 ShowDateTime(); ShowWeatherATommorow(); if(SystemTimer>180) { TIM_Cmd(TIM2,DISABLE); GetWeather(0); SystemTimer=0; TIM_Cmd(TIM2,ENABLE); } } else if(PageNum==2) { if(IsNaoZhong1==1)HMISendCMD("t1.txt=\"闹钟1:开\""); else HMISendCMD("t1.txt=\"闹钟1:关\""); if(IsNaoZhong2==1)HMISendCMD("t3.txt=\"闹钟2:开\""); else HMISendCMD("t3.txt=\"闹钟2:关\""); if(IsNaoZhong3==1)HMISendCMD("t12.txt=\"闹钟3:开\""); else HMISendCMD("t12.txt=\"闹钟3:关\""); sprintf((char*)str40,"t5.txt=\"%d\"",naozhogn1_shi);HMISendCMD((char*)str40); sprintf((char*)str40,"t10.txt=\"%d\"",naozhogn1_fen);HMISendCMD((char*)str40); sprintf((char*)str40,"t2.txt=\"%d\"",naozhogn2_shi);HMISendCMD((char*)str40); sprintf((char*)str40,"t6.txt=\"%d\"",naozhogn2_fen);HMISendCMD((char*)str40); sprintf((char*)str40,"t8.txt=\"%d\"",naozhogn3_shi);HMISendCMD((char*)str40); sprintf((char*)str40,"t14.txt=\"%d\"",naozhogn3_fen);HMISendCMD((char*)str40); switch(Cursor) { case 1:HMISendCMD("t1.pco=63840");HMISendCMD("t5.pco=0");HMISendCMD("t10.pco=0");HMISendCMD("t3.pco=0");HMISendCMD("t2.pco=0");HMISendCMD("t6.pco=0");HMISendCMD("t12.pco=0");HMISendCMD("t8.pco=0");HMISendCMD("t14.pco=0");break; case 2:HMISendCMD("t1.pco=0");HMISendCMD("t5.pco=63840");HMISendCMD("t10.pco=0");HMISendCMD("t3.pco=0");HMISendCMD("t2.pco=0");HMISendCMD("t6.pco=0");HMISendCMD("t12.pco=0");HMISendCMD("t8.pco=0");HMISendCMD("t14.pco=0");break; case 3:HMISendCMD("t1.pco=0");HMISendCMD("t5.pco=0");HMISendCMD("t10.pco=63840");HMISendCMD("t3.pco=0");HMISendCMD("t2.pco=0");HMISendCMD("t6.pco=0");HMISendCMD("t12.pco=0");HMISendCMD("t8.pco=0");HMISendCMD("t14.pco=0");break; case 4:HMISendCMD("t1.pco=0");HMISendCMD("t5.pco=0");HMISendCMD("t10.pco=0");HMISendCMD("t3.pco=63840");HMISendCMD("t2.pco=0");HMISendCMD("t6.pco=0");HMISendCMD("t12.pco=0");HMISendCMD("t8.pco=0");HMISendCMD("t14.pco=0");break; case 5:HMISendCMD("t1.pco=0");HMISendCMD("t5.pco=0");HMISendCMD("t10.pco=0");HMISendCMD("t3.pco=0");HMISendCMD("t2.pco=63840");HMISendCMD("t6.pco=0");HMISendCMD("t12.pco=0");HMISendCMD("t8.pco=0");HMISendCMD("t14.pco=0");break; case 6:HMISendCMD("t1.pco=0");HMISendCMD("t5.pco=0");HMISendCMD("t10.pco=0");HMISendCMD("t3.pco=0");HMISendCMD("t2.pco=0");HMISendCMD("t6.pco=63840");HMISendCMD("t12.pco=0");HMISendCMD("t8.pco=0");HMISendCMD("t14.pco=0");break; case 7:HMISendCMD("t1.pco=0");HMISendCMD("t5.pco=0");HMISendCMD("t10.pco=0");HMISendCMD("t3.pco=0");HMISendCMD("t2.pco=0");HMISendCMD("t6.pco=0");HMISendCMD("t12.pco=63840");HMISendCMD("t8.pco=0");HMISendCMD("t14.pco=0");break; case 8:HMISendCMD("t1.pco=0");HMISendCMD("t5.pco=0");HMISendCMD("t10.pco=0");HMISendCMD("t3.pco=0");HMISendCMD("t2.pco=0");HMISendCMD("t6.pco=0");HMISendCMD("t12.pco=0");HMISendCMD("t8.pco=63840");HMISendCMD("t14.pco=0");break; case 9:HMISendCMD("t1.pco=0");HMISendCMD("t5.pco=0");HMISendCMD("t10.pco=0");HMISendCMD("t3.pco=0");HMISendCMD("t2.pco=0");HMISendCMD("t6.pco=0");HMISendCMD("t12.pco=0");HMISendCMD("t8.pco=0");HMISendCMD("t14.pco=63840");break; } } if(isfreash==1) { isfreash=0; switch(PageNum) { case 1:HMISendCMD("page page0");break; case 2:HMISendCMD("page page1");break; } } //24进制 asr01_SendData8(DS1302_Time.hour); asr01_SendData8(DS1302_Time.min); asr01_SendData8(0); //闹钟 DS1302_Time.hour DS1302_Time.min DS1302_Time.sec if((naozhogn1_shi == DS1302_Time.hour && DS1302_Time.min == naozhogn1_fen && DS1302_Time.sec<5) && IsNaoZhong1==1)IsDaoDaJiShiDian_1=1; if((naozhogn2_shi == DS1302_Time.hour && DS1302_Time.min == naozhogn2_fen && DS1302_Time.sec<5) && IsNaoZhong2==1)IsDaoDaJiShiDian_2=1; if((naozhogn3_shi == DS1302_Time.hour && DS1302_Time.min == naozhogn3_fen && DS1302_Time.sec<5) && IsNaoZhong3==1)IsDaoDaJiShiDian_3=1; if(IsDaoDaJiShiDian_1==1 || IsDaoDaJiShiDian_2==1 || IsDaoDaJiShiDian_3==1) { PCout(6)=0;delay_ms(200); PCout(6)=1;delay_ms(100); } } } /*============================================ 函数名称:void Blue_SendData(void) 函数说明:发送的数据是JSON字符串 使用说明:上位机解析json字符串来完成数据的接受,构建下面的json字符串 "{\"params\":{\"K1\"}}" =============================================*/ void Blue_SendData(void) { char temp[256]; int length=0; int testDate; // sprintf((char*)temp,"%d & %d & %d & %d &\ // %d & %d & %.1f & %.1f &\ // %d & %d & %d & %d &",\ // IsleftYaoTou,IsUpYaoTou,IsleftYaoTouAngle,IsUpYaoTouAngle,\ // ShouDongDangWei,Contromode,Ds18b20Temp,Ds18b20SetTemp, // SetDS1302_Time3.hour,SetDS1302_Time3.min,SetDS1302_Time2.hour,SetDS1302_Time2.min); sprintf((char*)temp,"%s KQ%dDQ",temp,strlen(temp)); bluetooth_printf(temp);//调用蓝牙串口发送数据 } void CalibrationTimeDealingData(void); /*============================================ 函数名称:void BT_NVIC_IRQFun(void) 函数说明:接收从上位机发送过的数据 使用说明:上位机发送过来的数据按照以下格式 A数据G,A是帧头,G是帧尾,中间的是需要接受的数据 =============================================*/ void BT_NVIC_IRQFun(void) { u8 Res,i; u8 year,month,day,hour,minuter,Sec; if(USART_GetITStatus(BT_UART, USART_IT_RXNE) != RESET) //接收中断(接收到的数据必须是0x0d 0x0a结尾) { Res =USART_ReceiveData(BT_UART); //读取接收到的数据 BT_RX_BUF[BT_RX_STA++]=Res; if(strstr((char *)BT_RX_BUF,"G"))//接收到结束字符 //E0G { BT_RX_STA=0;//接收计数变成0 //判断发送过来的数据是否包含"A",举例CharToNum(BT_RX_BUF[1])就是A后面跟随的第一个数字; if(strstr((char *)BT_RX_BUF,"A") ){PageNum=2;isfreash=1;} else if(strstr((char *)BT_RX_BUF,"B")){PageNum=3;isfreash=1;IsStart=0;JiShi_Ms=0;JiShi_S=0;JiShiFen=0;} else if(strstr((char *)BT_RX_BUF,"C")){PageNum=1;isfreash=1;} else if(strstr((char *)BT_RX_BUF,"D")){Dim+=10;if(Dim>=100)Dim=100;sprintf((char*)str40,"dim=%d",Dim);HMISendCMD((char*)str40);} else if(strstr((char *)BT_RX_BUF,"E")){if(Dim>=10)Dim-=10;sprintf((char*)str40,"dim=%d",Dim);HMISendCMD((char*)str40);} else if(strstr((char *)BT_RX_BUF,"F")){SendCMD(Start,4);} else if(strstr((char *)BT_RX_BUF,"H")){SendCMD(Pause,4);} else if(strstr((char *)BT_RX_BUF,"I")){SendCMD(PreviouSong,4);} else if(strstr((char *)BT_RX_BUF,"J")){SendCMD(NextSong,4);} else if(strstr((char *)BT_RX_BUF,"U")){if(IsNaoZhong1==1)IsNaoZhong1=0;else IsNaoZhong1=1;} else if(strstr((char *)BT_RX_BUF,"V")){if(IsNaoZhong2==1)IsNaoZhong2=0;else IsNaoZhong2=1;} else if(strstr((char *)BT_RX_BUF,"W")){if(IsNaoZhong3==1)IsNaoZhong3=0;else IsNaoZhong3=1;} //闹钟1设定 else if(strstr((char *)BT_RX_BUF,"X")) { naozhogn1_shi = CharToNum(BT_RX_BUF[1])*10+CharToNum(BT_RX_BUF[2]); naozhogn1_fen = CharToNum(BT_RX_BUF[3])*10+CharToNum(BT_RX_BUF[4]); } else if(strstr((char *)BT_RX_BUF,"Y")) { naozhogn2_shi = CharToNum(BT_RX_BUF[1])*10+CharToNum(BT_RX_BUF[2]); naozhogn2_fen = CharToNum(BT_RX_BUF[3])*10+CharToNum(BT_RX_BUF[4]); } else if(strstr((char *)BT_RX_BUF,"Z")) { naozhogn3_shi = CharToNum(BT_RX_BUF[1])*10+CharToNum(BT_RX_BUF[2]); naozhogn3_fen = CharToNum(BT_RX_BUF[3])*10+CharToNum(BT_RX_BUF[4]); } BT_RX_STA=0; memset(BT_RX_BUF,0,50); } } } u8 res; //==语音缓冲区串口接收中断 void ASR_NVIC_IRQFun(void) { static u8 Count=0,IsYouXia=0; if(USART_GetITStatus(ASR_UART, USART_IT_RXNE) != RESET) { res=ASR_UART->DR; switch(res) { case 0x04:Dim+=10;if(Dim>=100)Dim=100;sprintf((char*)str40,"dim=%d",Dim);HMISendCMD((char*)str40);break; case 0x05:if(Dim>=10)Dim-=10;sprintf((char*)str40,"dim=%d",Dim);HMISendCMD((char*)str40);break; case 0x06:SendCMD(Start,4);break;//查询状态 case 0x07:SendCMD(Pause,4);break;//查询状态 case 0x08:SendCMD(PreviouSong,4);break;//查询状态 case 0x09:SendCMD(NextSong,4);break;//查询状态 case 0x10:IsStart=1;break;//查询状态 case 0x11:IsStart=0;break;//查询状态 } } } /*-------------------------------------------------*/ /*函数名:定时器2中断服务函数 */ /*参 数:无 */ /*返回值:无 */ /*-------------------------------------------------*/ void TIM2_IRQHandler(void) { //如果TIM_IT_Update置位,表示TIM2溢出中断,进入if if(TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) { SystemTimer_ms++; if(SystemTimer_ms>=5) { SystemTimer_ms=0; //全局计时的变量+1,表示过去了1秒钟 SystemTimer++; if(IsStart==1) { count+=100; if(count>=1000)count=0; ServoSetCnt(TIM3,2,count);ServoSetCnt(TIM3,3,1000);ServoSetCnt(TIM3,4,1000);delay_ms(500); ServoSetCnt(TIM3,3,1000);ServoSetCnt(TIM3,3,count);ServoSetCnt(TIM3,4,1000);delay_ms(500); ServoSetCnt(TIM3,2,1000);ServoSetCnt(TIM3,3,1000);ServoSetCnt(TIM3,4,count); } else{ ServoSetCnt(TIM3,2,1000); ServoSetCnt(TIM3,3,1000); ServoSetCnt(TIM3,4,1000); } } //清除TIM2溢出中断标志 TIM_ClearITPendingBit(TIM2, TIM_IT_Update); } } /*==================================================================================================== 天气现象代码说明: 0白天晴 1夜晚晴 4多云 5,6晴间多云 7,8大部多云 9阴 10阵雨 11雷阵雨 12 雷阵雨伴有冰雹 13小雨 14中雨 15大雨 16暴雨 17大暴雨 18特大暴雨 19冻雨 20雨夹雪 21阵雪 22小雪 23 中雪 24大雪 25暴雪 26浮尘 27扬尘 28 沙尘暴 29强沙尘暴 31霾 32风 34大风 35热带风暴 36龙卷风 37冷 38热 99未知 =====================================================================================================*/ //调用HMI显示天气状况 void ShowWeatherAfterTommorow(void) { u8 a=0; a=Today.day_code; //根据天气控制显示 switch(a) { case 1 :case 0 : case 2 :HMISendCMD("t1.txt=\"今:晴\"");break;//晴 case 3 :case 4 :case 5:case 6:case 7: case 8 :HMISendCMD("t1.txt=\"今:多云\"");break;//多云 case 9 :HMISendCMD("t1.txt=\"今:阴\"");break;//阴 case 10:HMISendCMD("t1.txt=\"今:阵雨\"");break;//阵雨 case 11: case 12:HMISendCMD("t1.txt=\"今:雷雨\"");break;//雷阵雨 case 13:HMISendCMD("t1.txt=\"今:小雨\"");break;//小雨 case 14:HMISendCMD("t1.txt=\"今:中雨\"");break;//中雨 case 15:HMISendCMD("t1.txt=\"今:大雨\"");break;//大雨 case 16:HMISendCMD("t1.txt=\"今:暴雨\"");break;//暴雨 case 17: case 18:HMISendCMD("t1.txt=\"今:暴雨\"");break;//大暴雨 case 19:HMISendCMD("t1.txt=\"今:冻雨\"");break;//冻雨 case 20:HMISendCMD("t1.txt=\"今:雨雪\"");break;//雨夹雪 case 21:HMISendCMD("t1.txt=\"今:阵雪\"");break;//阵雪 case 22:HMISendCMD("t1.txt=\"今:小雪\"");break;//小雪 case 23:HMISendCMD("t1.txt=\"今:中雪\"");break;//中雪 case 24:HMISendCMD("t1.txt=\"今:大雪\"");break;//大雪 case 25:HMISendCMD("t1.txt=\"今:暴雪\"");break;//暴雪 default:HMISendCMD("t1.txt=\"今:未知\"");break;//未知 } } //调用HMI显示天气状况 void ShowWeatherATommorow(void) { u8 a=0; a=tomrrow.day_code; //根据天气控制显示 switch(a) { case 1 :case 0 : case 2 :HMISendCMD("t0.txt=\"明:晴\"");break;//晴 case 3 :case 4 :case 5:case 6:case 7: case 8 :HMISendCMD("t0.txt=\"明:多云\"");break;//多云 case 9 :HMISendCMD("t0.txt=\"明:阴\"");break;//阴 case 10:HMISendCMD("t0.txt=\"明:阵雨\"");break;//阵雨 case 11: case 12:HMISendCMD("t0.txt=\"明:雷雨\"");break;//雷阵雨 case 13:HMISendCMD("t0.txt=\"明:小雨\"");break;//小雨 case 14:HMISendCMD("t0.txt=\"明:中雨\"");break;//中雨 case 15:HMISendCMD("t0.txt=\"明:大雨\"");break;//大雨 case 16:HMISendCMD("t0.txt=\"明:暴雨\"");break;//暴雨 case 17: case 18:HMISendCMD("t0.txt=\"明:暴雨\"");break;//大暴雨 case 19:HMISendCMD("t0.txt=\"明:冻雨\"");break;//冻雨 case 20:HMISendCMD("t0.txt=\"明:雨雪\"");break;//雨夹雪 case 21:HMISendCMD("t0.txt=\"明:阵雪\"");break;//阵雪 case 22:HMISendCMD("t0.txt=\"明:小雪\"");break;//小雪 case 23:HMISendCMD("t0.txt=\"明:中雪\"");break;//中雪 case 24:HMISendCMD("t0.txt=\"明:大雪\"");break;//大雪 case 25:HMISendCMD("t0.txt=\"明:暴雪\"");break;//暴雪 default:HMISendCMD("t0.txt=\"明:未知\"");break;//未知 } } //显示期和时间 //显示期和时间 void ShowDateTime(void) { u8 Str[30]=""; DS1302_Readtime(); if(DS1302_Time.mouth==10 || DS1302_Time.mouth==11 || DS1302_Time.mouth==12 ){ if(DS1302_Time.date>=1 && DS1302_Time.date<=9)sprintf((char*)Str,"t14.txt=\"20%d年%d月0%d-武汉\"", DS1302_Time.year,DS1302_Time.mouth,DS1302_Time.date); else sprintf((char*)Str,"t14.txt=\"20%d年%d月%d-武汉\"", DS1302_Time.year,DS1302_Time.mouth,DS1302_Time.date); }else{ if(DS1302_Time.date>=1 && DS1302_Time.date<=9)sprintf((char*)Str,"t14.txt=\"20%d年0%d月0%d-武汉\"", DS1302_Time.year,DS1302_Time.mouth,DS1302_Time.date); else sprintf((char*)Str,"t14.txt=\"20%d年0%d月%d-武汉\"", DS1302_Time.year,DS1302_Time.mouth,DS1302_Time.date); } HMISendCMD((char*)Str);delay_ms(100); if(DS1302_Time.hour>=0 && DS1302_Time.hour<=9){ if(DS1302_Time.min>=0 && DS1302_Time.min<=9){ if(DS1302_Time.sec>=0 && DS1302_Time.sec<=9)sprintf((char*)Str,"t4.txt=\"0%d:0%d:0%d\"", DS1302_Time.hour,DS1302_Time.min,DS1302_Time.sec); else sprintf((char*)Str,"t4.txt=\"0%d:0%d:%d\"", DS1302_Time.hour,DS1302_Time.min,DS1302_Time.sec); }else{ if(DS1302_Time.sec>=0 && DS1302_Time.sec<=9)sprintf((char*)Str,"t4.txt=\"0%d:%d:0%d\"", DS1302_Time.hour,DS1302_Time.min,DS1302_Time.sec); else sprintf((char*)Str,"t4.txt=\"0%d:%d:%d\"", DS1302_Time.hour,DS1302_Time.min,DS1302_Time.sec); } }else{ if(DS1302_Time.min>=0 && DS1302_Time.min<=9){ if(DS1302_Time.sec>=0 && DS1302_Time.sec<=9)sprintf((char*)Str,"t4.txt=\"%d:0%d:0%d\"", DS1302_Time.hour,DS1302_Time.min,DS1302_Time.sec); else sprintf((char*)Str,"t4.txt=\"%d:0%d:%d\"", DS1302_Time.hour,DS1302_Time.min,DS1302_Time.sec); }else{ if(DS1302_Time.sec>=0 && DS1302_Time.sec<=9)sprintf((char*)Str,"t4.txt=\"%d:%d:0%d\"", DS1302_Time.hour,DS1302_Time.min,DS1302_Time.sec); else sprintf((char*)Str,"t4.txt=\"%d:%d:%d\"", DS1302_Time.hour,DS1302_Time.min,DS1302_Time.sec); } } HMISendCMD((char*)Str); } //1.上回调函数 void UP_KeyCallBackFunction(void) { if(PageNum==1)JInZhi=1; if(PageNum==2) { Cursor--; if(Cursor==0)Cursor=9; } } //1.左回调函数 void DOWN_KeyCallBackFunction(void) { if(PageNum==1)JInZhi=0; if(PageNum==2) { Cursor++; if(Cursor==10)Cursor=1; } } //1.下回调函数 void RIGHT_KeyCallBackFunction(void) { switch(Cursor) { case 1:IsNaoZhong1=1;break; case 2:while(GPIO_ReadInputDataBit(KEY_RIGHT_PORT,KEY_RIGHT_Pin)==0){naozhogn1_shi++;delay_ms(100);sprintf((char*)str40,"t5.txt=\"%d\"",naozhogn1_shi);HMISendCMD((char*)str40);}break; case 3:while(GPIO_ReadInputDataBit(KEY_RIGHT_PORT,KEY_RIGHT_Pin)==0){naozhogn1_fen++;delay_ms(100); sprintf((char*)str40,"t10.txt=\"%d\"",naozhogn1_fen);HMISendCMD((char*)str40);}break; case 4:IsNaoZhong2=1;break; case 5:while(GPIO_ReadInputDataBit(KEY_RIGHT_PORT,KEY_RIGHT_Pin)==0){naozhogn2_shi++;delay_ms(100);sprintf((char*)str40,"t2.txt=\"%d\"",naozhogn2_shi);HMISendCMD((char*)str40);}break; case 6:while(GPIO_ReadInputDataBit(KEY_RIGHT_PORT,KEY_RIGHT_Pin)==0){naozhogn2_fen++;delay_ms(100);sprintf((char*)str40,"t6.txt=\"%d\"",naozhogn2_fen);HMISendCMD((char*)str40);}break; case 7:IsNaoZhong3=1;break; case 8:while(GPIO_ReadInputDataBit(KEY_RIGHT_PORT,KEY_RIGHT_Pin)==0){naozhogn3_shi++;delay_ms(100);sprintf((char*)str40,"t8.txt=\"%d\"",naozhogn3_shi);HMISendCMD((char*)str40);}break; case 9:while(GPIO_ReadInputDataBit(KEY_RIGHT_PORT,KEY_RIGHT_Pin)==0){naozhogn3_fen++;delay_ms(100);sprintf((char*)str40,"t14.txt=\"%d\"",naozhogn3_fen);HMISendCMD((char*)str40); }break; } } //1.右回调函数 void LEFT_TKeyCallBackFunction(void) { switch(Cursor) { case 1:IsNaoZhong1=0;break; case 2:while(GPIO_ReadInputDataBit(KEY_LEFT_PORT,KEY_LEFT_Pin)==0){naozhogn1_shi--;delay_ms(100);sprintf((char*)str40,"t5.txt=\"%d\"",naozhogn1_shi);HMISendCMD((char*)str40);}break; case 3:while(GPIO_ReadInputDataBit(KEY_LEFT_PORT,KEY_LEFT_Pin)==0){naozhogn1_fen--;delay_ms(100);sprintf((char*)str40,"t10.txt=\"%d\"",naozhogn1_fen);HMISendCMD((char*)str40);}break; case 4:IsNaoZhong2=0;break; case 5:while(GPIO_ReadInputDataBit(KEY_LEFT_PORT,KEY_LEFT_Pin)==0){naozhogn2_shi--;delay_ms(100);sprintf((char*)str40,"t2.txt=\"%d\"",naozhogn2_shi);HMISendCMD((char*)str40);}break; case 6:while(GPIO_ReadInputDataBit(KEY_LEFT_PORT,KEY_LEFT_Pin)==0){naozhogn2_fen--;delay_ms(100);sprintf((char*)str40,"t6.txt=\"%d\"",naozhogn2_fen);HMISendCMD((char*)str40);}break; case 7:IsNaoZhong3=0;break; case 8:while(GPIO_ReadInputDataBit(KEY_LEFT_PORT,KEY_LEFT_Pin)==0){naozhogn3_shi--;delay_ms(100);sprintf((char*)str40,"t8.txt=\"%d\"",naozhogn3_shi);HMISendCMD((char*)str40);}break; case 9:while(GPIO_ReadInputDataBit(KEY_LEFT_PORT,KEY_LEFT_Pin)==0){naozhogn3_fen--;delay_ms(100);sprintf((char*)str40,"t14.txt=\"%d\"",naozhogn3_fen);HMISendCMD((char*)str40); }break; } } //确认回调函数 void CONFIRM_CallBackFunction(void) { if(IsDaoDaJiShiDian_1==1 || IsDaoDaJiShiDian_2==1 || IsDaoDaJiShiDian_3==1 ) { IsDaoDaJiShiDian_1=0;IsDaoDaJiShiDian_2=0;IsDaoDaJiShiDian_3=0; } PageNum++; if(PageNum==3)PageNum=1; isfreash=1; } //==禁用JTAG,使能SWD void JTAGDIS_SWDENABLE(void) { RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE); GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); } /*==============================================================end of file=============================================================================================*/ 分析该代码
05-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值