国产免费AV|泡泡玛特欧洲总部将设在伦敦|中文天堂网www新版资源在线|一本久道综合在线中文|国精产品一二三产区的使用方法|香蕉鱼在线观看|www.27eee
ELEOK
標題:
ec20 4g傳輸光照度、溫濕度至阿里云平臺 STM32源程序
[打印本頁]
作者:
路漫漫
時間:
2020-6-7 00:08
標題:
ec20 4g傳輸光照度、溫濕度至阿里云平臺 STM32源程序
ec20 stm32 阿里云完整源碼:
sunctrl.7z
(2.95 MB, 售價: 1 E幣)
2020-6-7 00:06 上傳
點擊文件名下載附件
售價: 1 E幣
[記錄]
[
購買
]
部分源碼:
#pragma import(__use_no_semihosting)
//標準庫需要的支持函數
struct __FILE
{
int handle;
};
FILE __stdout;
//定義_sys_exit()以避免使用半主機模式
void _sys_exit(int x)
{
x = x;
}
//重定義fputc函數
int fputc(int ch, FILE *f)
{
while((USART1->SR&0X40)==0);//循環發送,直到發送完畢
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;//設置二維碼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;//設置二維碼成功
// printf("Meassage.QRcode:%s\r\n",Meassage.QRcode);
}
else
{
Meassage.Error_Code=53;//設置二維碼成功失敗
}
}
Rseponse=1;
}
……………………
…………限于本文篇幅 余下代碼請下載附件…………
復制代碼
歡迎光臨 ELEOK (http://www.afoofa.cn/)
Powered by Discuz! X5.0