基于状态机编写4G模块驱动函数文章来源:https://www.toymoban.com/news/detail-680973.html
#include "bsp.h"
char LTE_TX[512],LTE_RX[512];
int LTE_TX_length,LTE_RX_length;
char U1_TX_data[512],U1_RX_data[512];
char LTE_DATA_buf[512];
char LTE_COM_buf[512];
char LTE_SEND_buf[512];
unsigned char U1_TX_flag,U1_RX_flag;
u16 U1_Tx_Counter,U1_Rx_Counter;
char LTE_AT_state;
char LTE_state;
char LTE_SEND0,LTE_SEND1,LTE_SEND2,LTE_SEND3;
char LTE_Connections; //LTEÁ¬½Ó±êÖ¾ 0£ºÎ´Á¬½Ó
char LTE_TEMP_str[32];
void UART1_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
DMA_InitTypeDef DMA_Initstructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOE, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 , ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1,ENABLE);
RCC_APB1PeriphClockCmd( RCC_APB1Periph_TIM2 , ENABLE);
//4G POWER
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOE, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_ResetBits(GPIOE, GPIO_Pin_1);
//4G_PWRKEY
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_SetBits(GPIOE, GPIO_Pin_3);
//4G_RESET
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_ResetBits(GPIOB, GPIO_Pin_1);
//4G_RELAY
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_SetBits(GPIOE, GPIO_Pin_8);
GPIO_SetBits(GPIOE, GPIO_Pin_9);
/* USART1 GPIO config */
/* Configure USART1 Tx (PA.09) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure USART1 Rx (PA.10) as input floating */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* USART1 mode config */
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART1, &USART_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority=1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/*uart1 RX DMAÅäÖÃ*/
DMA_Initstructure.DMA_PeripheralBaseAddr = (u32)(&USART1->DR);
DMA_Initstructure.DMA_MemoryBaseAddr = (u32)U1_RX_data;
DMA_Initstructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_Initstructure.DMA_BufferSize = 512;
DMA_Initstructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_Initstructure.DMA_MemoryInc =DMA_MemoryInc_Enable;
DMA_Initstructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_Initstructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_Initstructure.DMA_Mode = DMA_Mode_Normal;
DMA_Initstructure.DMA_Priority = DMA_Priority_High;
DMA_Initstructure.DMA_M2M = DMA_M2M_Disable;
DMA_Init(DMA1_Channel5,&DMA_Initstructure); //Æô¶¯DMA
DMA_Cmd(DMA1_Channel5,ENABLE);
USART_ITConfig(USART1, USART_IT_IDLE, ENABLE);
USART_DMACmd(USART1,USART_DMAReq_Rx,ENABLE);
USART_Cmd(USART1, ENABLE);
}
struct //×÷Òµ²ÉÑù
{
u16 LTE_Head;
u16 LTE_Tail;
u16 LTE_Lenght;
char LTE_Buf[4][512];
int LTE_Len[4];
}LTE_Ring;
void LTE_Ring_Init(void)
{
LTE_Ring.LTE_Head=0;
LTE_Ring.LTE_Tail=0;
LTE_Ring.LTE_Lenght=0;
LTE_Ring.LTE_Len[0]=0;
LTE_Ring.LTE_Len[1]=0;
LTE_Ring.LTE_Len[2]=0;
LTE_Ring.LTE_Len[3]=0;
}
unsigned char LTE_Write_Ring(char *data,unsigned int len)
{
if(LTE_Ring.LTE_Lenght >= 4)
{
return 0;
}
LTE_Ring.LTE_Len[LTE_Ring.LTE_Tail]=len;
memcpy(LTE_Ring.LTE_Buf[LTE_Ring.LTE_Tail],data,len);
LTE_Ring.LTE_Tail = (LTE_Ring.LTE_Tail+1)%4;
LTE_Ring.LTE_Lenght++;
return 1;
}
unsigned char LTE_Read_Ring(char *Data)
{
int len;
if(LTE_Ring.LTE_Lenght == 0)
{
return 0;
}
len=LTE_Ring.LTE_Len[LTE_Ring.LTE_Head];
memcpy(Data,LTE_Ring.LTE_Buf[LTE_Ring.LTE_Head],len);
memset(LTE_Ring.LTE_Buf[LTE_Ring.LTE_Head],0,len);
LTE_Ring.LTE_Len[LTE_Ring.LTE_Head]=0;
LTE_Ring.LTE_Head = (LTE_Ring.LTE_Head+1)%4;
LTE_Ring.LTE_Lenght--;
return len;
}
struct //×÷Òµ²ÉÑù
{
u16 LTE_Head;
u16 LTE_Tail;
u16 LTE_Lenght;
char LTE_Buf[4][512];
int LTE_Len[4];
}LTE1_T_Ring;
void LTE1_T_Ring_Init(void)
{
LTE1_T_Ring.LTE_Head=0;
LTE1_T_Ring.LTE_Tail=0;
LTE1_T_Ring.LTE_Lenght=0;
LTE1_T_Ring.LTE_Len[0]=0;
LTE1_T_Ring.LTE_Len[1]=0;
LTE1_T_Ring.LTE_Len[2]=0;
LTE1_T_Ring.LTE_Len[3]=0;
}
unsigned char LTE1_T_Write_Ring(char *data,unsigned int len)
{
if(LTE1_T_Ring.LTE_Lenght >= 4)
{
return 0;
}
LTE1_T_Ring.LTE_Len[LTE1_T_Ring.LTE_Tail]=len;
memcpy(LTE1_T_Ring.LTE_Buf[LTE1_T_Ring.LTE_Tail],data,len);
LTE1_T_Ring.LTE_Tail = (LTE1_T_Ring.LTE_Tail+1)%4;
LTE1_T_Ring.LTE_Lenght++;
return 1;
}
unsigned char LTE1_T_Read_Ring(char *Data)
{
int len;
if(LTE1_T_Ring.LTE_Lenght == 0)
{
return 0;
}
len=LTE1_T_Ring.LTE_Len[LTE1_T_Ring.LTE_Head];
memcpy(Data,LTE1_T_Ring.LTE_Buf[LTE1_T_Ring.LTE_Head],len);
memset(LTE1_T_Ring.LTE_Buf[LTE1_T_Ring.LTE_Head],0,len);
LTE1_T_Ring.LTE_Len[LTE1_T_Ring.LTE_Head]=0;
LTE1_T_Ring.LTE_Head = (LTE1_T_Ring.LTE_Head+1)%4;
LTE1_T_Ring.LTE_Lenght--;
return len;
}
struct //×÷Òµ²ÉÑù
{
u16 LTE_Head;
u16 LTE_Tail;
u16 LTE_Lenght;
char LTE_Buf[4][512];
int LTE_Len[4];
}LTE2_T_Ring;
void LTE2_T_Ring_Init(void)
{
LTE2_T_Ring.LTE_Head=0;
LTE2_T_Ring.LTE_Tail=0;
LTE2_T_Ring.LTE_Lenght=0;
LTE2_T_Ring.LTE_Len[0]=0;
LTE2_T_Ring.LTE_Len[1]=0;
LTE2_T_Ring.LTE_Len[2]=0;
LTE2_T_Ring.LTE_Len[3]=0;
}
unsigned char LTE2_T_Write_Ring(char *data,unsigned int len)
{
if(LTE2_T_Ring.LTE_Lenght >= 4)
{
return 0;
}
LTE2_T_Ring.LTE_Len[LTE2_T_Ring.LTE_Tail]=len;
memcpy(LTE2_T_Ring.LTE_Buf[LTE2_T_Ring.LTE_Tail],data,len);
LTE2_T_Ring.LTE_Tail = (LTE2_T_Ring.LTE_Tail+1)%4;
LTE2_T_Ring.LTE_Lenght++;
return 1;
}
unsigned char LTE2_T_Read_Ring(char *Data)
{
int len;
if(LTE2_T_Ring.LTE_Lenght == 0)
{
return 0;
}
len=LTE2_T_Ring.LTE_Len[LTE2_T_Ring.LTE_Head];
memcpy(Data,LTE2_T_Ring.LTE_Buf[LTE2_T_Ring.LTE_Head],len);
memset(LTE2_T_Ring.LTE_Buf[LTE2_T_Ring.LTE_Head],0,len);
LTE2_T_Ring.LTE_Len[LTE2_T_Ring.LTE_Head]=0;
LTE2_T_Ring.LTE_Head = (LTE2_T_Ring.LTE_Head+1)%4;
LTE2_T_Ring.LTE_Lenght--;
return len;
}
struct //×÷Òµ²ÉÑù
{
u16 LTE_Head;
u16 LTE_Tail;
u16 LTE_Lenght;
char LTE_Buf[4][512];
int LTE_Len[4];
}LTE3_T_Ring;
void LTE3_T_Ring_Init(void)
{
LTE3_T_Ring.LTE_Head=0;
LTE3_T_Ring.LTE_Tail=0;
LTE3_T_Ring.LTE_Lenght=0;
LTE3_T_Ring.LTE_Len[0]=0;
LTE3_T_Ring.LTE_Len[1]=0;
LTE3_T_Ring.LTE_Len[2]=0;
LTE3_T_Ring.LTE_Len[3]=0;
}
unsigned char LTE3_T_Write_Ring(char *data,unsigned int len)
{
if(LTE3_T_Ring.LTE_Lenght >= 4)
{
return 0;
}
LTE3_T_Ring.LTE_Len[LTE3_T_Ring.LTE_Tail]=len;
memcpy(LTE3_T_Ring.LTE_Buf[LTE3_T_Ring.LTE_Tail],data,len);
LTE3_T_Ring.LTE_Tail = (LTE3_T_Ring.LTE_Tail+1)%4;
LTE3_T_Ring.LTE_Lenght++;
return 1;
}
unsigned char LTE3_T_Read_Ring(char *Data)
{
int len;
if(LTE3_T_Ring.LTE_Lenght == 0)
{
return 0;
}
len=LTE3_T_Ring.LTE_Len[LTE3_T_Ring.LTE_Head];
memcpy(Data,LTE3_T_Ring.LTE_Buf[LTE3_T_Ring.LTE_Head],len);
memset(LTE3_T_Ring.LTE_Buf[LTE3_T_Ring.LTE_Head],0,len);
LTE3_T_Ring.LTE_Len[LTE3_T_Ring.LTE_Head]=0;
LTE3_T_Ring.LTE_Head = (LTE3_T_Ring.LTE_Head+1)%4;
LTE3_T_Ring.LTE_Lenght--;
return len;
}
void USART1_IRQHandler(void)
{
unsigned int i,j;
char *buf;
if(USART_GetITStatus(USART1,USART_IT_IDLE) == SET)
{
USART1->SR;
USART1->DR;
DMA_Cmd(DMA1_Channel5,DISABLE);
U1_Rx_Counter = 512 - DMA_GetCurrDataCounter(DMA1_Channel5);
if(buf=strstr(U1_RX_data, "RECV FROM:"))
{
if(buf=strstr(U1_RX_data, "114.116.6.187:10000"))
{
if(buf=strstr(U1_RX_data, "+IPD"))
{
for(i=0;i<512;i++)
{
if(buf[i]==0x0d)
{
if((buf[25]==0x70)&&(buf[26]==0x01)&&(buf[29]==0x01)) //+2µÚÒ»¸ö×Ö½Ú
{
for(j=0;j<30;j++)
{
LTE_IP[j]=buf[j+32];
}
LTE_PORT=(buf[62]<<8)+buf[63];
for(j=0;j<4;j++)
{
local_ip[j]=buf[j+64];
}
for(j=0;j<4;j++)
{
mask_ip[j]=buf[j+68];
}
for(j=0;j<4;j++)
{
gateway_ip[j]=buf[j+72];
}
for(j=0;j<32;j++)
{
Lorawan_EUI[j]=buf[j+83];
}
for(j=0;j<32;j++)
{
Lorawan_DevAddr[j]=buf[j+115];
}
LTE_Connections=1;
}
if((buf[25]==0x70)&&(buf[26]==0x01)&&(buf[29]==0x00))
{
LTE_Connections=0;
}
break;
}
}
}
}
if(buf=strstr(U1_RX_data, "114.116.6.187:20000"))
{
if(buf=strstr(U1_RX_data, "+IPD"))
{
for(i=0;i<512;i++)
{
if(buf[i]==0x0d)
{
if(i==5)UART2_T_Write_Ring((buf+7),(buf[4]-0x30));//1×Ö½Ú
if(i==6)UART2_T_Write_Ring((buf+8),(((buf[4]-0x30)*10)+(buf[5]-0x30)));//2×Ö½Ú
if(i==7)UART2_T_Write_Ring((buf+9),(((buf[4]-0x30)*100)+((buf[5]-0x30)*10)+(buf[6]-0x30)));//3×Ö½Ú
if(i==8)UART2_T_Write_Ring((buf+10),(((buf[4]-0x30)*1000)+((buf[5]-0x30)*100)+((buf[6]-0x30)*10)+(buf[7]-0x30)));//4×Ö½Ú
break;
}
}
}
}
if(buf=strstr(U1_RX_data, "114.116.6.187:30000"))
{
if(buf=strstr(U1_RX_data, "+IPD"))
{
for(i=0;i<512;i++)
{
if(buf[i]==0x0d)
{
if(i==5)UART3_T_Write_Ring((buf+7),(buf[4]-0x30));//1×Ö½Ú
if(i==6)UART3_T_Write_Ring((buf+8),(((buf[4]-0x30)*10)+(buf[5]-0x30)));//2×Ö½Ú
if(i==7)UART3_T_Write_Ring((buf+9),(((buf[4]-0x30)*100)+((buf[5]-0x30)*10)+(buf[6]-0x30)));//3×Ö½Ú
if(i==8)UART3_T_Write_Ring((buf+10),(((buf[4]-0x30)*1000)+((buf[5]-0x30)*100)+((buf[6]-0x30)*10)+(buf[7]-0x30)));//4×Ö½Ú
break;
}
}
}
}
if(buf=strstr(U1_RX_data, "114.116.6.187:40000"))
{
if(buf=strstr(U1_RX_data, "+IPD"))
{
for(i=0;i<512;i++)
{
if(buf[i]==0x0d)
{
if(i==5)UART5_T_Write_Ring((buf+7),(buf[4]-0x30));//1×Ö½Ú
if(i==6)UART5_T_Write_Ring((buf+8),(((buf[4]-0x30)*10)+(buf[5]-0x30)));//2×Ö½Ú
if(i==7)UART5_T_Write_Ring((buf+9),(((buf[4]-0x30)*100)+((buf[5]-0x30)*10)+(buf[6]-0x30)));//3×Ö½Ú
if(i==8)UART5_T_Write_Ring((buf+10),(((buf[4]-0x30)*1000)+((buf[5]-0x30)*100)+((buf[6]-0x30)*10)+(buf[7]-0x30)));//4×Ö½Ú
break;
}
}
}
}
}
else
{
LTE_Write_Ring(U1_RX_data,U1_Rx_Counter);
}
DMA1_Channel5->CNDTR = 512;
DMA_Cmd(DMA1_Channel5,ENABLE);
}
}
void U1_SendString(char *buf1)
{
unsigned int i;
unsigned int len;
len=strlen(buf1);
for(i=0;i<len;i++)
{
while(USART_GetFlagStatus(USART1,USART_FLAG_TC)== RESET);
USART_SendData(USART1,buf1[i]);
}
}
void USART1_Send(char *buf,unsigned int len)
{
unsigned int i;
for(i=0;i<len;i++)
{
while(USART_GetFlagStatus(USART1,USART_FLAG_TC)== RESET);
USART_SendData(USART1,buf[i]);
}
}
void LED1_OPEN(void)
{
GPIO_WriteBit(GPIOE, GPIO_Pin_13, Bit_SET);
}
void LED1_CLOSE(void)
{
GPIO_WriteBit(GPIOE, GPIO_Pin_13, Bit_RESET);
}
void LTE_ATTR(int time1,int time2,int time3,char * buf1,char * buf2,char * buf3,char * buf4,char * buf5,char * buf6,char r ,char w)
{
unsigned int len;
switch(LTE_AT_state)
{
case state_idle:
if(LTE_Delay_Timer>time1)
{
LTE_Delay_Timer=0;
LTE_Timeslimite++;
len=strlen(buf1);
USART1_Send(buf1,len);
LTE_AT_state=state_run;
}
break;
case state_run:
LED1_OPEN();
LTE_Delay_Timer=0;
if(LTE_Read_Ring(LTE_DATA_buf)>0)
{
if((strstr(LTE_DATA_buf, buf2))&&(strlen(buf2))) //×Ö·û´®±È½Ï²»ÄÜÓÐ00£¬¹Ø±Õ»ØÏÔ±ÜÃâÊý¾ÝÖеÄ00Ó°Ïì±È½Ï
{
LTE_AT_state=state_right;
}
else if((strstr(LTE_DATA_buf, buf3))&&(strlen(buf3)))
{
LTE_AT_state=state_right;
}
else if((strstr(LTE_DATA_buf, buf4))&&(strlen(buf4)))
{
LTE_AT_state=state_wrong;
}
else if((strstr(LTE_DATA_buf, buf5))&&(strlen(buf5)))
{
LTE_AT_state=state_wrong;
}
else if((strstr(LTE_DATA_buf, buf6))&&(strlen(buf6)))
{
LTE_AT_state=state_wrong;
}
}
if(LTE_Timeslimite>time2)
{
LTE_AT_state=state_wrong;
}
if(LTE_overtime>time3)
{
LTE_AT_state=state_wrong;
}
break;
case state_right:
LTE_state=r;
LTE_AT_state=state_idle;
LTE_Delay_Timer=0;
LTE_overtime=0;
LTE_Timeslimite=0;
LED1_CLOSE();
memset(LTE_DATA_buf,0,512);
break;
case state_wrong:
LTE_state=w;
LTE_AT_state=state_idle;
LTE_Delay_Timer=0;
LTE_overtime=0;
LTE_Timeslimite=0;
LED1_CLOSE();
memset(LTE_DATA_buf,0,512);
break;
default:
break;
}
}
void LTE_DATATR(int time1,int time2,int time3,char * buf1,int len,char * buf2,char * buf3,char * buf4,char * buf5,char * buf6,char r ,char w)
{
switch(LTE_AT_state)
{
case state_idle:
if(LTE_Delay_Timer>time1)
{
LTE_Delay_Timer=0;
LTE_Timeslimite++;
USART1_Send(buf1,len);
LTE_AT_state=state_run;
}
break;
case state_run:
LED1_OPEN();
LTE_Delay_Timer=0;
if(LTE_Read_Ring(LTE_DATA_buf)>0)
{
if((strstr(LTE_DATA_buf, buf2))&&(strlen(buf2))) //×Ö·û´®±È½Ï²»ÄÜÓÐ00£¬¹Ø±Õ»ØÏÔ±ÜÃâÊý¾ÝÖеÄ00Ó°Ïì±È½Ï
{
LTE_AT_state=state_right;
}
else if((strstr(LTE_DATA_buf, buf3))&&(strlen(buf3)))
{
LTE_AT_state=state_right;
}
else if((strstr(LTE_DATA_buf, buf4))&&(strlen(buf4)))
{
LTE_AT_state=state_wrong;
}
else if((strstr(LTE_DATA_buf, buf5))&&(strlen(buf5)))
{
LTE_AT_state=state_wrong;
}
else if((strstr(LTE_DATA_buf, buf6))&&(strlen(buf6)))
{
LTE_AT_state=state_wrong;
}
}
if(LTE_Timeslimite>time2)
{
LTE_AT_state=state_wrong;
}
if(LTE_overtime>time3)
{
LTE_AT_state=state_wrong;
}
break;
case state_right:
LTE_state=r;
LTE_AT_state=state_idle;
LTE_Delay_Timer=0;
LTE_overtime=0;
LTE_Timeslimite=0;
LED1_CLOSE();
memset(LTE_DATA_buf,0,512);
break;
case state_wrong:
LTE_state=w;
LTE_AT_state=state_idle;
LTE_Delay_Timer=0;
LTE_overtime=0;
LTE_Timeslimite=0;
LED1_CLOSE();
memset(LTE_DATA_buf,0,512);
break;
default:
break;
}
}
void LTE_POWER(void)
{
int i,j;
GPIO_WriteBit(GPIOE, GPIO_Pin_1, Bit_SET);
for(i=0;i<1000;i++)for(j=0;j<1000;j++);
GPIO_WriteBit(GPIOE, GPIO_Pin_1, Bit_RESET);
for(i=0;i<1000;i++)for(j=0;j<1000;j++);
}
void LTE_KEY(void)
{
int i,j;
GPIO_WriteBit(GPIOE, GPIO_Pin_3, Bit_RESET);
for(i=0;i<1000;i++)for(j=0;j<1000;j++);
GPIO_WriteBit(GPIOE, GPIO_Pin_3, Bit_SET);
for(i=0;i<1000;i++)for(j=0;j<1000;j++);
}
void LTE_RST(void)
{
int i,j;
GPIO_WriteBit(GPIOB, GPIO_Pin_1, Bit_RESET);
for(i=0;i<1000;i++)for(j=0;j<1000;j++);
GPIO_WriteBit(GPIOB, GPIO_Pin_1, Bit_SET);
for(i=0;i<1000;i++)for(j=0;j<1000;j++);
}
/*********************************************END OF FILE**********************/
.h文件文章来源地址https://www.toymoban.com/news/detail-680973.html
#ifndef __BSP_UART1_H
#define __BSP_UART1_H
void UART1_Config(void);
void LTE_Ring_Init(void);
unsigned char LTE_Write_Ring(char *data,unsigned int len);
unsigned char LTE_Read_Ring(char *Data);
void LTE1_T_Ring_Init(void);
unsigned char LTE1_T_Write_Ring(char *data,unsigned int len);
unsigned char LTE1_T_Read_Ring(char *Data);
void LTE2_T_Ring_Init(void);
unsigned char LTE2_T_Write_Ring(char *data,unsigned int len);
unsigned char LTE2_T_Read_Ring(char *Data);
void LTE3_T_Ring_Init(void);
unsigned char LTE3_T_Write_Ring(char *data,unsigned int len);
unsigned char LTE3_T_Read_Ring(char *Data);
void U1_SendString(char *buf1);
void USART1_Send(char *buf,unsigned int len);
void LED1_OPEN(void);
void LED1_CLOSE(void);
void LTE_ATTR(int time1,int time2,int time3,char * buf1,char * buf2,char * buf3,char * buf4,char * buf5,char * buf6,char r ,char w);
void LTE_DATATR(int time1,int time2,int time3,char * buf1,int len,char * buf2,char * buf3,char * buf4,char * buf5,char * buf6,char r ,char w);
void LTE_POWER(void);
void LTE_KEY(void);
void LTE_RST(void);
#endif /* __BSP_UART1_H */
到了这里,关于STM32 物联网 4G CAT1 SIMCOM A7680C 源码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!