|
基本功能全實(shí)現(xiàn)了,擴(kuò)張功能實(shí)現(xiàn)了IIC和錄音機(jī),還實(shí)現(xiàn)了WIFI上傳。有問(wèn)題可以提出來(lái),供大家一起討論。圖片附件
7HX7S$RL1%OJ(8G37~1T`SH.png (84.99 KB, 下載次數(shù): 51)
下載附件
題目
2020-12-30 17:14 上傳
單片機(jī)源程序如下:
- #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 "w25qxx.h"
- #include "sdio_sdcard.h"
- #include "ff.h"
- #include "exfuns.h"
- #include "fontupd.h"
- #include "text.h"
- #include "wm8978.h"
- #include "audioplay.h"
- #include "recorder.h"
- #include "24cxx.h"
- #include "dht11.h"
- #include "adc.h"
- #include "timer.h"
- #include "cgq.h"
- #include "usart2.h"
- #include "wifi.h"
- u8 volume = 32;
- u8 action_sign;
- extern u8 temperature,humidity,led_state,speed,temp1,temp2;
- int main(void)
- {
- u8 key;
- u8 number_table[7];
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//設(shè)置系統(tǒng)中斷優(yōu)先級(jí)分組2
- delay_init(168); //初始化延時(shí)函數(shù)
- uart_init(115200); //初始化串口波特率為115200
- Usart3_Init(115200);
- LED_Init(); //初始化LED
- LCD_Init(); //LCD初始化
- KEY_Init(); //按鍵初始化
- W25QXX_Init(); //初始化W25Q128
- WM8978_Init(); //初始化WM8978
- WM8978_HPvol_Set(40,40); //耳機(jī)音量設(shè)置
- WM8978_SPKvol_Set(volume); //喇叭音量設(shè)置
- Adc_Init();
-
- TIM5_CH1_Cap_Init(0XFFFFFFFF,84-1); //以1Mhz的頻率計(jì)數(shù)
- WiFi_ResetIO_Init();
- usmart_dev.init(84); //初始化USMART
- while(DHT11_Init())
- {
- printf("DHT11不存在");
- }
-
- my_mem_init(SRAMIN); //初始化內(nèi)部?jī)?nèi)存池
- my_mem_init(SRAMCCM); //初始化CCM內(nèi)存池
- exfuns_init(); //為fatfs相關(guān)變量申請(qǐng)內(nèi)存
- f_mount(fs[0],"0:",1); //掛載SD卡
- POINT_COLOR=RED;
- while(AT24CXX_Check())//檢測(cè)不到24c02
- {
- LCD_ShowString(30,110,200,16,16,"24C02 Check Failed!");
- delay_ms(500);
- LCD_ShowString(30,110,200,16,16,"Please Check! ");
- delay_ms(500);
- LED0=!LED0;//DS0閃爍
- }
- while(font_init()) //檢查字庫(kù)
- {
- LCD_ShowString(30,40,200,16,16,"Font Error!");
- delay_ms(200);
- LCD_Fill(30,40,240,66,WHITE);//清除顯示
- delay_ms(200);
- }
- POINT_COLOR=RED;
- Show_Str(30,50,200,16,"Explorer STM32開(kāi)發(fā)板",16,0);
- Show_Str(30,70,200,16,"車(chē)載系統(tǒng)",16,0);
- Show_Str(30,90,200,16,"2020年12月13日",16,0);
- Show_Str(30,110,200,16,"KEY0:播放器 KEY2:錄音機(jī)",16,0);
- Show_Str(30,130,200,16,"KEY1:傳感器 KEY3:調(diào)速 ",16,0);
-
- AT24CXX_Read(0,number_table,7);
- if(number_table[0] == 128)
- {
- temperature = number_table[1];
- humidity = number_table[2];
- led_state = number_table[3];
- speed = number_table[4];
- temp1 = number_table[5];
- temp2 = number_table[6];
- //printf("%d-%d-%d-%d-%d-%d\r\n",temperature,humidity,led_state,speed,temp1,temp2);
- }
- initial_interface();
- TIM2_Int_Init(20000,8399);
- while(1)
- {
- key = KEY_Scan(0);
- switch(key)
- {
- case KEY0_PRES:audio_play();initial_interface();break;
- case KEY2_PRES:wav_recorder();initial_interface();break;
- case KEY1_PRES:cc();initial_interface();break;
- case WKUP_PRES:xgsd();initial_interface();break;
- }
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
代碼.7z
(821 KB, 下載次數(shù): 16)
2020-12-31 15:07 上傳
點(diǎn)擊文件名下載附件
源代碼 下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|