#include "os_task.h"
|
#include "cpu.h"
|
#include "wtd.h"
|
|
/*驱动层头文件*/
|
#include "gpio.h"
|
#include "pwm.h"
|
//#include "adc.h"
|
#include "uart.h"
|
/*数据抽象层头文件*/
|
|
/*系统基本函数定义*/
|
static void SystemConfig(void);
|
static void BSP_Config(void);
|
static void Init(void);
|
/*定义任务*/
|
|
static void WatchDogThread(void *p)
|
{
|
WatchDogService();
|
}
|
|
static void Test_10msThread(void *p)
|
{
|
static uint16_t i = 0;
|
putchar(++i);
|
}
|
|
static void Test_1msThread(void *p)
|
{
|
GPIO_SetSDH2136Disbale();
|
}
|
|
void main(void)
|
{
|
|
OS_TASK_MSG task_queue[6] = {0};
|
InitOSTaskQueue(task_queue, 6);
|
|
SystemConfig(); /*配置最小系统和OS时钟*/
|
BSP_Config(); /*底层硬件初始化*/
|
|
Init(); /*初始化应用层和数据抽象层*/
|
enableInterrupts();
|
OSTaskCreate(Test_10msThread, 1000, 1, NULL);
|
OSTaskCreate(WatchDogThread, 10, 3, NULL); /*喂狗任务*/
|
OSTaskCreate(Test_1msThread, 1, 1, NULL); /*1ms测试任务*/
|
OSSchedule(TickTime);
|
}
|
|
/* User can add his own implementation to report the file name and line number,
|
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
/* Infinite loop */
|
void assert_failed(uint8_t *file, uint32_t line)
|
{
|
while (1)
|
;
|
}
|
|
void SystemConfig(void)
|
{
|
/*配置芯片最小系统:系统时钟配置*/
|
CLK_Config(); /*配置时钟*/
|
WatchDogConfig();
|
OSTimer_Config(); /*配置OStimer 1ms基准*/
|
}
|
|
void BSP_Config(void)
|
{
|
/*底层硬件驱动,硬件抽象层配置*/
|
GPIO_Config();
|
// ADC_Init(); /*配置ADC*/
|
PWM_Config();
|
InitUart();
|
// HAL_Init();
|
}
|
|
void Init(void)
|
{
|
// InitUart();
|
}
|