单独例程可以正常运行,可是集成到adc的例程后就不响应了,请问何故?
代码如下:
void gpioButtonFxn10(uint_least8_t index) {/* Clear the GPIO interrupt and toggle an LED */GPIO_toggle(Board_GPIO_LED1); } /* /***** Function definitions *****/ void NodeTask_init(void) { GPIO_setConfig(Board_GPIO_BUTTON0, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);/* Turn on user LED */GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);/* install Button callback */GPIO_setCallback(Board_GPIO_BUTTON0, gpioButtonFxn10);/* Enable interrupts */GPIO_enableInt(Board_GPIO_BUTTON0);/* Create event used internally for state changes */Event_Params eventParam;Event_Params_init(&eventParam);Event_construct(&nodeEvent, &eventParam);nodeEventHandle = Event_handle(&nodeEvent);/* Create the node task */Task_Params_init(&nodeTaskParams);nodeTaskParams.stackSize = NODE_TASK_STACK_SIZE;nodeTaskParams.priority = NODE_TASK_PRIORITY;nodeTaskParams.stack = &nodeTaskStack;Task_construct(&nodeTask, nodeTaskFunction, &nodeTaskParams, NULL); } static void nodeTaskFunction(UArg arg0, UArg arg1) {/* Open LED pins */ledPinHandle = PIN_open(&ledPinState, pinTable);if (!ledPinHandle){System_abort("Error initializing board 3.3V domain pins\n");}/* Start the SCE ADC task with 1s sample period and reacting to change in ADC value. */SceAdc_init(0x00010000/30, NODE_ADCTASK_REPORTINTERVAL_FAST, NODE_ADCTASK_CHANGE_MASK);SceAdc_setReportInterval(200,150);SceAdc_registerAdcCallback(adcCallback);SceAdc_start();while(1) {/* Wait for event */uint32_t events = Event_pend(nodeEventHandle, 0, NODE_EVENT_ALL, BIOS_WAIT_FOREVER);/* If new ADC value, send this data */if (events & NODE_EVENT_NEW_ADC_VALUE) {/* Toggle activity LED *///PIN_setOutputValue(ledPinHandle, NODE_ACTIVITY_LED,!PIN_getOutputValue(NODE_ACTIVITY_LED));/* Send ADC value to concentrator */NodeRadioTask_sendAdcData(&latestAdcValue);}} } void adcCallback(struct adc_values *currentadcvalues) {/* Save latest value */latestAdcValue = *currentadcvalues;/* Post event */Event_post(nodeEventHandle, NODE_EVENT_NEW_ADC_VALUE); }
Eggsy Pang:
你是说gpio进不了中断吗?Gpio的引脚和ADC有没有冲突?