各位好:
自从我新建立定時器跟任务
代码执行一次后,卡在SimplePeripheral_createTask
SDK:simplelink_cc13x2_26x2_sdk_5_20_00_52_for_CC6252r
static Clock_Struct ecgClock;
spClockEventData_t argecg =
{ .event = SP_ECG_EVT };
void SimplePeripheral_createTask(void)
{
Task_Params taskParams;
// Configure task
Task_Params_init(&taskParams);
taskParams.stack = spTaskStack;
taskParams.stackSize = SP_TASK_STACK_SIZE;
taskParams.priority = SP_TASK_PRIORITY;
Task_construct(&spTask, SimplePeripheral_taskFxn, &taskParams, NULL);
}
static void SimplePeripheral_init(void)
{
.
.
.
Util_constructClock(&ecgClock, SimplePeripheral_clockHandler, 1000, 0, true, (UArg)&argecg);
.
.
.
}
static void SimplePeripheral_clockHandler(UArg arg)
{
spClockEventData_t *pData = (spClockEventData_t *)arg;
if (pData->event == SP_PERIODIC_EVT)
{
// Start the next period
Util_startClock(&clkPeriodic);
// Post event to wake up the application
SimplePeripheral_enqueueMsg(SP_PERIODIC_EVT, NULL);
}
else if (pData->event == SP_READ_RPA_EVT)
{
// Start the next period
Util_startClock(&clkRpaRead);
// Post event to read the current RPA
SimplePeripheral_enqueueMsg(SP_READ_RPA_EVT, NULL);
}
else if (pData->event == SP_SEND_PARAM_UPDATE_EVT)
{
// Send message to app
SimplePeripheral_enqueueMsg(SP_SEND_PARAM_UPDATE_EVT, pData);
}
else if( pData->event == SP_ECG_EVT)
{
SimplePeripheral_enqueueMsg(SP_ECG_EVT, NULL);
}
}
static void ecg_Handler(void)
{
ADC_Params_init(¶ms);
adc = ADC_open(CONFIG_ADC_0, ¶ms);
if (adc == NULL) {
Display_printf(displayHandle, 0, 0, "Error initializing CONFIG_ADC_0\n");
while (1);
}
res = ADC_convert(adc, &adcValue0);
if (res == ADC_STATUS_SUCCESS) {
adcValue0MicroVolt = ADC_convertRawToMicroVolts(adc, adcValue0);
Display_printf(displayHandle, 0, 0, "CONFIG_ADC_0 raw result: %d\n", adcValue0);
Display_printf(displayHandle, 0, 0, "CONFIG_ADC_0 convert result: %d uV\n",adcValue0MicroVolt);
}
ADC_close(adc);
}