1、任务创建
// Task configuration
#define HEARTRATE_TASK_PRIORITY 2
#define HEARTRATE_TASK_STACK_SIZE 1300//644
void HeartRate_createTask(void) {Task_Params taskParams;// Configure taskTask_Params_init(&taskParams);taskParams.stack = HeartRate_taskStack;taskParams.stackSize = HEARTRATE_TASK_STACK_SIZE;taskParams.priority = HEARTRATE_TASK_PRIORITY;Task_construct(&HeartRate_task, HeartRate_taskFxn, &taskParams, NULL);OXY_createTask(); } #define OXY_TASK_PRIORITY1 #define OXY_TASK_STACK_SIZE1000//644 // Task configuration Task_Struct OXY_task; Char OXY_taskStack[OXY_TASK_STACK_SIZE]; static void OXY_taskFxn(UArg a0, UArg a1); // Entity ID globally used to check for source and/or destination of messages. static ICall_EntityID selfEntity; static ICall_SyncHandle syncEvent; void OXY_createTask(void) {Task_Params taskParams;// Configure taskTask_Params_init(&taskParams);taskParams.stack = OXY_taskStack;taskParams.stackSize = OXY_TASK_STACK_SIZE;taskParams.priority = OXY_TASK_PRIORITY;Task_construct(&OXY_task, OXY_taskFxn, &taskParams, NULL); }
2、创建的新任务
static void OXY_taskFxn(UArg a0, UArg a1) {ICall_registerApp(&selfEntity, &syncEvent);InitSPI();InitUart();//InitTimer();InitAdc();while(1){WriteSPI("te", 2);ReadAdc();// WriteUart("test ok\r\n", 9);Task_sleep(10*100);} }
是哪里操作不当么?
user1388075:
SPI的transfer mode是BLOCKING,会不会和这个有关啊
const SPI_Params SPI_defaultParams = {
SPI_MODE_BLOCKING, /* transferMode */
100,//SPI_WAIT_FOREVER, /* transferTimeout */
NULL, /* transferCallbackFxn */
SPI_MASTER, /* mode */
8000000, /* bitRate */
8, /* dataSize */
SPI_POL0_PHA0, /* frameFormat */
NULL /* custom */
};
Kevin Qiu1:
回复 user1388075:
创建任务可以参考:www.ti.com/…/spruex3t.pdf
也可以看下project_zero例程