资源简介
STM32_EC20源码 , 驱动完成初始话,实现基本功能,,,
代码片段和文件信息
#include “stm32f10x.h“
#include “usart2.h“
#include “usart3.h“
#include “sysTick.h“
#include
#include “stdio.h“
#include “ec20.h“
#include “config.h“
static uint8_t ec20_net_status = EC20_PW_CHECK;
static uint8_t ec20_url_statuc = 0;
static uint16_t rCount = 0;
static uint16_t rTime = 0;
uint8_t G_Post_Buf[4096];
uint16_t Post_Len = 0;
int rssi = 0erate = 0;
void EC20_Set_Power_Off(void)
{
GPIO_ResetBits(GPIOAGPIO_Pin_1);
}
void EC20_Power_on(void)
{
GPIO_SetBits(GPIOAGPIO_Pin_1);
}
//AT ->OK\r\n
u8 EC20_Power_Check(void)
{
Display_On = 0;
rssi = 0;
USART2_RX_STA=0;
u2_printf(“AT\r\n“);
ec20_net_status = EC20_PW_CHECK;
delay_ms(100);
rCount ++;
rTime = 5;
return 0;
}
u8 EC20_Echo_Off(void)
{
USART2_RX_STA=0;
u2_printf(“ATE0\r\n“);
ec20_net_status = EC20_CEREG;
rCount++;
rTime = 20;
return 0;
}
u8 EC20_Sim_Ready(void)
{
USART2_RX_STA=0;
u2_printf(“AT+CPIN?\r\n“);
ec20_net_status = EC20_READY;
rCount++;
rTime = 100;
return 0;
}
u8 EC20_Check_Creg(void)
{
USART2_RX_STA=0;
u2_printf(“AT+CREG?\r\n“);
//ec20_net_status = EC20_AT_CHECK;
rCount++;
rTime = 200;
return 0;
}
u8 EC20_Check_Cereg(void)
{
USART2_RX_STA=0;
u2_printf(“AT+CEREG?\r\n“);
//ec20_net_status = EC20_AT_CHECK;
rCount++;
rTime = 200;
return 0;
}
u8 EC20_Active_Set(void)
{
USART2_RX_STA=0;
u2_printf(“AT+QIACT=1\r\n“);
//ec20_net_status = EC20_AT_CHECK;
rCount++;
rTime = 10;
return 0;
}
u8 EC20_Active_Check(void)
{
USART2_RX_STA=0;
u2_printf(“AT+QIACT?\r\n“);
//ec20_net_status = EC20_AT_CHECK;
rCount++;
rTime = 200;
return 0;
}
u8 EC20_Get_Csq(void)
{
USART2_RX_STA=0;
Display_On = 0;
u2_printf(“AT+CSQ\r\n“);
//ec20_net_status = EC20_AT_CHECK;
return 0;
}
u8 EC20_Pro(void)
{
// u3_printf(“ec20_net_status=%x\n“ec20_net_status);
if(rTime != 0)
return 0;
switch(ec20_net_status)
{
case EC20_OFF:EC20_Set_Power_Off();break;//ec20_net_status=EC20_ON;
case EC20_ON:EC20_Power_on();break;
case EC20_PW_CHECK:delay_ms(100);/*u3_printf(“EC20_Power_Check\n“);*/EC20_Power_Check();break;
case EC20_ECHO_OFF:delay_ms(100);/*u3_printf(“EC20_Echo_Off\n“);*/EC20_Echo_Off();//dnot break;
case EC20_READY:delay_ms(100);/*u3_printf(“EC20_Sim_Ready\n“);*/EC20_Sim_Ready();break;
case EC20_CREG:delay_ms(100);/*u3_printf(“EC20_Check_Creg\n“);*/EC20_Check_Creg();break;
case EC20_CEREG:delay_ms(100);/*u3_printf(“EC20_Check_Cereg\n“);*/EC20_Check_Cereg();break;
case EC20_ACT_SET:delay_ms(100);/*u3_printf(“EC20_Active_Set\n“);*/EC20_Active_Set();break;
case EC20_ACT_CHECK:delay_ms(100);/*u3_printf(“EC20_Active_Check\n“);*/EC20_Active_Check();break;
case EC20_CSQ:/*u3_printf(“EC20_Get_Csq\n“);*/EC20_Get_Csq();break;
}
return 0;
}
u8 Net_Data_Cheak_Pro(void)
{
static int pw_time = 0;
char ipaddr[32];
if(rCount > 20){
ec20_net_status = EC20_OFF;
rCount = 0;
}
if(rTime
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-30 16:51 STM32_EC20\
文件 8396 2018-03-29 22:59 STM32_EC20\ec20.c
文件 718 2018-03-28 21:12 STM32_EC20\ec20.h
文件 2483 2018-03-29 22:55 STM32_EC20\timer5.c
文件 79 2018-03-26 23:20 STM32_EC20\timer5.h
文件 5165 2018-03-29 23:00 STM32_EC20\usart2.c
文件 702 2018-03-27 22:15 STM32_EC20\usart2.h
文件 3701 2018-03-28 09:09 STM32_EC20\web.c
文件 115 2018-03-26 22:43 STM32_EC20\web.h
- 上一篇:备份libjpeg.so.62
- 下一篇:1602LCD液晶显示程序汇编.
评论
共有 条评论