- #include "sys.h"
- #include "delay.h"
- #include "usart.h"
- #include "led.h"
- #include "lcd.h"
- #include "key.h"
- #include "usmart.h"
- #include "malloc.h"
- #include "sdio_sdcard.h"
- #include "w25qxx.h"
- #include "ff.h"
- #include "exfuns.h"
- #include "text.h"
- #include "touch.h"
- #include "usart3.h"
- #include "common.h"
-
- int main(void)
- {
- u8 key,fontok=0;
- LED0=0;
- delay_init(); //延时函数初始化
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级
- uart_init(115200); //串口初始化为115200
- usmart_dev.init(72); //初始化USMART
- LED_Init(); //初始化与LED连接的硬件接口
- KEY_Init(); //初始化按键
- LCD_Init(); //初始化LCD
- W25QXX_Init(); //初始化W25Q128
- tp_dev.init(); //初始化触摸屏
- usart3_init(115200); //初始化串口3
- my_mem_init(SRAMIN); //初始化内部内存池
- exfuns_init(); //为fatfs相关变量申请内存
- f_mount(fs[0],"0:",1); //挂载SD卡
- f_mount(fs[1],"1:",1); //挂载FLASH.
- key=KEY_Scan(0);
- if(key==KEY0_PRES&&((tp_dev.touchtype&0X80)==0))//强制校准
- {
- LCD_Clear(WHITE); //清屏0
- TP_Adjust(); //屏幕校准
- TP_Save_Adjdata();
- LCD_Clear(WHITE); //清屏
- }
- fontok=font_init(); //检查字库是否OK
- if(fontok||key==KEY1_PRES) //需要更新字库
- {
- LCD_Clear(WHITE); //清屏
- POINT_COLOR=RED; //设置字体为红色
- LCD_ShowString(60,50,200,16,16,"ALIENTEK STM32");
- while(SD_Init()) //检测SD卡
- {
- LCD_ShowString(60,70,200,16,16,"SD Card Failed!");
- delay_ms(200);
- LCD_Fill(60,70,200+60,70+16,WHITE);
- delay_ms(200);
- }
- LCD_ShowString(60,70,200,16,16,"SD Card OK");
- LCD_ShowString(60,90,200,16,16,"Font Updating...");
- key=update_font(20,110,16,"0:");//从SD卡更新
- while(key)//更新失败
- {
- LCD_ShowString(60,110,200,16,16,"Font Update Failed!");
- delay_ms(200);
- LCD_Fill(20,110,200+20,110+16,WHITE);
- delay_ms(200);
- }
- LCD_ShowString(60,110,200,16,16,"Font Update Success!");
- delay_ms(1500);
- LCD_Clear(WHITE);//清屏
- }
- atk_8266_test(); //进入ATK_ESP8266测试
- }
复制代码
代码工程下载:
适合战舰V3和精英STM32开发板)ATK-ESP8266 WIFI模块(数据接收处理控制成功).7z
(1.3 MB, 下载次数: 45)
|