ec20 stm32 阿里云完整源碼:
sunctrl.7z
(2.95 MB, 售價: 1 E幣)
2020-6-7 00:06 上傳
點擊文件名下載附件
售價: 1 E幣 [記錄]
[ 購買]
部分源碼:
- #pragma import(__use_no_semihosting)
- //標(biāo)準(zhǔn)庫需要的支持函數(shù)
- struct __FILE
- {
- int handle;
- };
- FILE __stdout;
- //定義_sys_exit()以避免使用半主機模式
- void _sys_exit(int x)
- {
- x = x;
- }
- //重定義fputc函數(shù)
- int fputc(int ch, FILE *f)
- {
- while((USART1->SR&0X40)==0);//循環(huán)發(fā)送,直到發(fā)送完畢
- USART1->DR = (uint8_t) ch;
- return ch;
- }
- #endif
- ///////////////////////////////////////////////////////////////
- void Usart1SendData_DMA(uint8_t *pdata, uint16_t Length)
- {
- // while( huart1.gState != HAL_UART_STATE_READY);
-
- //while(UsartType1.dmaSend_flag == USART_DMA_SENDING);
- UsartType1.dmaSend_flag = USART_DMA_SENDING;
- HAL_UART_Transmit_DMA(&huart1, pdata, Length);
-
- }
- void Usart2SendData_DMA(uint8_t *pdata, uint16_t Length)
- {
- //while( huart2.gState != HAL_UART_STATE_READY);
-
- //while(UsartType2.dmaSend_flag == USART_DMA_SENDING);
- UsartType2.dmaSend_flag = USART_DMA_SENDING;
- HAL_UART_Transmit_DMA(&huart2, pdata, Length);
-
- }
- void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
- {
- __HAL_DMA_DISABLE(huart->hdmatx);
- UsartType1.dmaSend_flag = USART_DMA_SENDOVER;
- UsartType2.dmaSend_flag = USART_DMA_SENDOVER;
- UsartType3.dmaSend_flag = USART_DMA_SENDOVER;
- }
- void START_TIM3()
- {
- #ifdef EN_WD
- IDWG_FEED();
- #endif
- //TIM3_Count=0;
- HAL_TIM_Base_Start_IT(&htim3);
- }
- void END_TIM3()
- {
- HAL_TIM_Base_Stop_IT(&htim3);
- }
- //uint8_t END_TIM3(uint16_t n)
- //{
- // if(n==0)
- // {
- // HAL_TIM_Base_Stop_IT(&htim3);
- // return 1;
- // }
- // else
- // {
- // if(n<TIM3_Count)
- // {
- // HAL_TIM_Base_Stop_IT(&htim3);
- // TIM3_Count=0;
- // return 1;
- // }
- // }
- // return 0;
- //}
- void GetMeassage(char *LMeassage)
- {
- char *ret;
- char buf[20];
- uint16_t i=0;
- uint16_t j=0;
- memset(&buf,0,20);
-
- // j=0;i=0;ret=NULL;
- // ret=strstr(LMeassage,"+QMTSTAT: 0,");
- //
- // if(ret!=NULL)
- // {
- //
- // }
-
- ///////////////////////////////////////////////////Switch1
- j=0;i=0;ret=NULL;
- ret=strstr(LMeassage,"Switch1");
- if(ret!=NULL)
- {
- Rseponse=1;
- if(ret[9]=='1')
- OPEN(0);
- else
- {
- CLOSE(0);
- }
- }
- ///////////////////////////////////////////////////Switch2
- j=0;i=0;ret=NULL;
- ret=strstr(LMeassage,"Switch2");
- if(ret!=NULL)
- {
- Rseponse=1;
- if(ret[9]=='1')
- OPEN(1);
- else
- {
- CLOSE(1);
- }
- }
- ///////////////////////////////////////////////////Switch3
- j=0;i=0;ret=NULL;
- ret=strstr(LMeassage,"Switch3");
- if(ret!=NULL)
- {
- Rseponse=1;
- if(ret[9]=='1')
- OPEN(2);
- else
- {
- CLOSE(2);
- }
- }
- ///////////////////////////////////////////////////Switch4
- j=0;i=0;ret=NULL;
- ret=strstr(LMeassage,"Switch4");
- if(ret!=NULL)
- {
- Rseponse=1;
- if(ret[9]=='1')
- OPEN(3);
- else
- {
- CLOSE(3);
- }
- }
- ///////////////////////////////////////////////////Switch5
- j=0;i=0;ret=NULL;
- ret=strstr(LMeassage,"Switch5");
- if(ret!=NULL)
- {
- Rseponse=1;
- if(ret[9]=='1')
- OPEN(4);
- else
- {
- CLOSE(4);
- }
- }
- ///////////////////////////////////////////////////Switch6
- j=0;i=0;ret=NULL;
- ret=strstr(LMeassage,"Switch6");
- if(ret!=NULL)
- {
- Rseponse=1;
- if(ret[9]=='1')
- OPEN(5);
- else
- {
- CLOSE(5);
- }
- }
-
- ///////////////////////////////////////////////////找QRcode
- j=0;i=0;ret=NULL;
- ret=strstr(LMeassage,"QRcode");
- if(ret!=NULL)
- {
- if(UsartType2.rx_len>1024)
- {
- Meassage.Error_Code=53;//設(shè)置二維碼error
- }
- //printf("%s",ret+9);
- else
- {
- if(ret[8]=='"')
- {
- memset(Meassage.QRcode,0,sizeof(Meassage.QRcode));
-
-
- for(i=0;i<UsartType2.rx_len;i++)
- {
- if(ret[9+i]=='"')break;
- Meassage.QRcode[j]=ret[i+9];
- j++;
- }
- nowSysParam.saveFlag=0x55;
- memcpy(&nowSysParam.saveData,&Meassage.QRcode,sizeof(Meassage.QRcode)); //????????????
- w25q_eraseSector(0x0000);
- w25q_writeNoCheck((uint8_t *)&nowSysParam,0x0000,sizeof(nowSysParam));//???????flash?
-
- Meassage.Error_Code=52;//設(shè)置二維碼成功
- // printf("Meassage.QRcode:%s\r\n",Meassage.QRcode);
-
- }
- else
- {
- Meassage.Error_Code=53;//設(shè)置二維碼成功失敗
- }
- }
- Rseponse=1;
- }
- ……………………
- …………限于本文篇幅 余下代碼請下載附件…………
復(fù)制代碼
【必讀】版權(quán)免責(zé)聲明
1、本主題所有言論和內(nèi)容純屬會員個人意見,與本論壇立場無關(guān)。2、本站對所發(fā)內(nèi)容真實性、客觀性、可用性不做任何保證也不負任何責(zé)任,網(wǎng)友之間僅出于學(xué)習(xí)目的進行交流。3、對提供的數(shù)字內(nèi)容不擁有任何權(quán)利,其版權(quán)歸原著者擁有。請勿將該數(shù)字內(nèi)容進行商業(yè)交易、轉(zhuǎn)載等行為,該內(nèi)容只為學(xué)習(xí)所提供,使用后發(fā)生的一切問題與本站無關(guān)。 4、本網(wǎng)站不保證本站提供的下載資源的準(zhǔn)確性、安全性和完整性;同時本網(wǎng)站也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的損失或傷害。 5、本網(wǎng)站所有軟件和資料均為網(wǎng)友推薦收集整理而來,僅供學(xué)習(xí)用途使用,請務(wù)必下載后兩小時內(nèi)刪除,禁止商用。6、如有侵犯你版權(quán)的,請及時聯(lián)系我們(電子郵箱1370723259@qq.com)指出,本站將立即改正。
|
|