[mw_shl_code=c,true]#include "delay.h"
#include "sys.h"
#include "lcd.h"
#include "sys.h"
#include "gt811.h"
#include "GUI.h"
#include "includes.h"
#include "led.h"
#include "bsp_sdio_sdcard.h"
#include "ff.h"
#include "diskio.h"
#include "GUI_Font16.h"
#include "MainTask.h"
#include "rtc.h"
#include "adc.h"
#include "dht11.h"
#include "UltrasonicWave.h"
#include "TIM2.h"
#include "fatapp.h"
#include "music.h"
#include "VS10XX.h"
#include "spi.h"
/////////////////////////UCOSII?????è??///////////////////////////////////
//START ????
//?è????????????
#define START_TASK_PRIO 55 //?????????????????è????×???
//?è???????????ó??
#define START_STK_SIZE 64
//????????
OS_STK START_TASK_STK[START_STK_SIZE];
//????????
void start_task(void *pdata);
//LED0????
//?è????????????
#define LED0_TASK_PRIO 10
//?è???????????ó??
#define LED0_STK_SIZE 32
//????????
OS_STK LED0_TASK_STK[LED0_STK_SIZE];
//????????
void led0_task(void *pdata);
//????????
//?è????????????
#define Touch_TASK_Prio 3
//?è???????????ó??
#define Touch_STK_SIZE 128
//????????
OS_STK TASK_Touch_STK[Touch_STK_SIZE];
//????????
void Task_Touch(void *pdata);
//???§????????
//?è????????????
#define Menu_TASK_Prio 7
//?è???????????ó??
#define Menu_STK_SIZE 1024
//????????
OS_STK TASK_Menu_STK[Menu_STK_SIZE];
//???§????????????
void Task_Menu(void *pdata);
//?÷????????????
//?è????????????
#define Collection_TASK_Prio 6
//?è???????????ó??
#define Collection_STK_SIZE 512
//????????
OS_STK TASK_Collection_STK[Collection_STK_SIZE];
//????????????
void Task_Collection(void *pdata);
//??????·?????
//?è????????????
//#define Playmusic_TASK_Prio 5
//?è???????????ó??
#define Playmusic_STK_SIZE 768
//????????
OS_STK TASK_Playmusic_STK[Playmusic_STK_SIZE];
//????????????
void Task_Playmusic(void *pdata);
int main(void)
{
delay_init(); //???±??????????
NVIC_Configuration();
LED_Init(); //????????LED??????????????
RTC_Init();
Adc_Init();
SPIx_Init();
VS_Init();
while(DHT11_Init());
// VS_Sine_Test();
// DHT11_GPIO_Config();
// Read_DHT11(&DHT11_Data);
TIM2_Configuration();
UltrasonicWave_Configuration();
while(ctp_dev.init())
delay_ms(200);
disk_initialize(0);
filecount=FileScan("0:mp3");
// while(1)
// {
// MainTask();
// }
OSInit();
OSTaskCreate(start_task,(void *)0,(OS_STK *)&START_TASK_STK[START_STK_SIZE-1],START_TASK_PRIO );//???¨????????
OSStart();
}
//????????
void start_task(void *pdata)
{
OS_CPU_SR cpu_sr=0;
pdata = pdata;
OS_ENTER_CRITICAL(); //??????????(??·¨±??????ò??)
OSTaskCreate(led0_task,(void *)0,(OS_STK*)&LED0_TASK_STK[LED0_STK_SIZE-1],LED0_TASK_PRIO);
OSTaskCreate(Task_Menu, (void * )0, (OS_STK *)&TASK_Menu_STK[Menu_STK_SIZE-1], Menu_TASK_Prio);
OSTaskCreate(Task_Touch, (void * )0, (OS_STK *)&TASK_Touch_STK[Touch_STK_SIZE-1], Touch_TASK_Prio);
OSTaskCreate(Task_Collection, (void * )0, (OS_STK *)&TASK_Collection_STK[Collection_STK_SIZE-1], Collection_TASK_Prio);
OSTaskCreate(Task_Playmusic, (void * )0, (OS_STK *)&TASK_Playmusic_STK[Playmusic_STK_SIZE-1], Playmusic_TASK_Prio);
// OSTaskSuspend(Playmusic_TASK_Prio);
OSTaskSuspend(START_TASK_PRIO); //????????????.
OS_EXIT_CRITICAL(); //??????????(????±??????ò??)
}
//LED0????
void led0_task(void *pdata)
{
while(1)
{
LED1=0;
delay_ms(80);
LED1=1;
delay_ms(920);
};
}
//???§????????
void Task_Menu(void *pdata)
{
while(1)
{
MainTask();
}
}
//??????·?????
void Task_Playmusic(void *pdata)
{
uint8_t filePath[20];
while(1)
{
strcpy((char *)filePath, "0:mp3/"); // °????????·??????tempPath????
strcat((char *)filePath, (char *)(FileN[file_num]));
play_mp3((char *)filePath);
delay_ms(6);
};
}
//????????
void Task_Touch(void *pdata)
{
while(1)
{
GUI_TOUCH_Exec();
delay_ms(10);
};
}
//????????
void Task_Collection(void *pdata)
{
u16 adcx;
u16 humi_int_temp;
u16 temp_int_temp;
u16 adc_t;
while (1)
{
DHT11_Read_Data(&temperature,&humidity); //????????????
if(humi_int_temp!=humidity)
water_fRefresh=1;
delay_ms(300);
if(temp_int_temp!=temperature)
temp_fRefresh=1;
delay_ms(300);
adcx=Get_Adc_Average(ADC_Channel_1,10);
adc_temp=adcx*(3.3/4096)*100;
if(adc_t!=adc_temp)
co2_fRefresh=1;
delay_ms(300);
UltrasonicWave_StartMeasure();
delay_ms(300);
}
}
[/mw_shl_code]
为什么我一加入了音乐播放的任务,屏幕的任务就不运行了呢? |