主函数
#include "gui.h"
#include "stm32f4xx.h"
#include "delay.h"
#include "led.h"
#include "usart.h"
#include "ucos_ii.h"
#include "pwm.h"
#include "control.h"
#include "app_cfg.h"
#include "bsp.h"
#include "24l01.h"
#include "spi.h"
//Task Stack Setting
#define APP_TASK_START_STK_SIZE 512
#define APP_LED1_STK_SIZE 1024
#define APP_NRF24L01_STK_SIZE 1024
#define APP_LED3_STK_SIZE 1024
//Task Priority
#define APP_TASK_START_PRIO 3
#define APP_LED1_PRIO 5
#define APP_NRF24L01_PRIO 4
#define APP_LED3_PRIO 7
//Stack Size setting
static OS_STK App_TaskStartStk[APP_TASK_START_STK_SIZE];
static OS_STK App_LED1Stk[APP_LED1_STK_SIZE];
static OS_STK App_NRF24L01Stk[APP_NRF24L01_STK_SIZE];
static OS_STK App_LED3Stk[APP_LED3_STK_SIZE];
//Function Statement
static void App_TaskStart(void *p_arg);
static void App_Task_LED1(void *p_arg);
static void App_Task_NRF24L01(void *p_arg);
static void App_Task_ACTION(void *p_arg);
u8 tmp_buf[33];//data received buffer
u8 cmd_last = 0xff;
static u8 cmd = 0; //command of action
int main(void)
{
OSInit(); //uC/OS-II init
TIM_Init();
NRF24L01_Init();
// Stand_Up();
LED_Init(); //LED Init
while(NRF24L01_Check())
{
LED1(On);
OSTimeDlyHMSM(0,0,0,50);
LED1(Off);
OSTimeDlyHMSM(0,0,0,50);
}
RX_Mode();
OSTaskCreate(App_TaskStart,(void*)0,(OS_STK*)&App_TaskStartStk[APP_TASK_START_STK_SIZE-1],APP_TASK_START_PRIO);
OSStart();

本文介绍了一个基于uC/OS-II操作系统的STM32应用实例,包括任务调度、SPI通信、NRF24L01无线模块使用等关键技术实现细节。
最低0.47元/天 解锁文章
914

被折叠的 条评论
为什么被折叠?



