void gnc_scheduled_stop(uint32 period) { task_set_period(TASK_SCHEDULED_STOP, period); task_enable(TASK_SCHEDULED_STOP); gnc_signal_command(1); }
static void button_handler(void) { GPIOPinIntClear(JOY_PORT, JOY_MASK); if (GPIOPinRead(JOY_PORT, JOY_MASK) > 0) { enabled = 0; GPIOPinWrite(ASSIST_PORT, (1<< AUX1_ASSIST_BIT), 0); task_enable(TASK_SET_OFFSET, 0); } else { enabled = 1; GPIOPinWrite(ASSIST_PORT, (1<< AUX1_ASSIST_BIT), (1<< AUX1_ASSIST_BIT)); } }
static void button_handler(void) { GPIOPinIntClear(JOY_PORT, JOY_MASK); if (GPIOPinRead(JOY_PORT, JOY_MASK) > 0) { enabled = 0; #if defined(CROSSHAIR_ENABLE_BIT) && CROSSHAIR_ENABLE_BIT >= 0 GPIOPinWrite(CROSSHAIR_PORT, (1<< CROSSHAIR_ENABLE_BIT), 0); #endif task_enable(TASK_SET_OFFSET, 0); } else { enabled = 1; #if defined(CROSSHAIR_ENABLE_BIT) && CROSSHAIR_ENABLE_BIT >= 0 GPIOPinWrite(CROSSHAIR_PORT, (1<< CROSSHAIR_ENABLE_BIT), (1<< CROSSHAIR_ENABLE_BIT)); #endif } }
/* * ======== cbRxHandler ======== * Callback handler for the USB stack. * * Callback handler call by the USB stack to notify us on what has happened in * regards to the keyboard. * * @param(cbData) A callback pointer provided by the client. * * @param(event) Identifies the event that occurred in regards to * this device. * * @param(eventMsgData) A data value associated with a particular event. * * @param(eventMsgPtr) A data pointer associated with a particular event. * */ static unsigned long cbRxHandler(void *cbData, unsigned long event, unsigned long eventMsg, void *eventMsgPtr) { switch (event) { case USB_EVENT_RX_AVAILABLE: GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_PIN_3); task_enable(TASK_SERIAL_RX, (void*)&rxBuffer); break; case USB_EVENT_DATA_REMAINING: break; case USB_EVENT_REQUEST_BUFFER: break; default: break; } return (0); }
static void joystick_isr(void) { TimerIntClear(JOY_TIMER, TIMER_TIMA_TIMEOUT); memset(&task_data,0,sizeof(struct task_manual_move_data)); // Only allow the joystick when AUX1 (Crosshair) is enabled if (enabled) { unsigned long x = joystick_x[0]; unsigned long y = joystick_y[0]; double x_off = 0; double y_off = 0; if (x > joystick_center[0] + ZERO_THRESHOLD) { x_off = (double)(x - joystick_center[0]) / 0x800; } else if (x < joystick_center[0] - ZERO_THRESHOLD) { x_off = -(double)(joystick_center[0] - x) / 0x800; } if (y > joystick_center[1] + ZERO_THRESHOLD) { y_off = (double)(y - joystick_center[1]) / 0x800; } else if (y < joystick_center[1] - ZERO_THRESHOLD) { y_off = -(double)(joystick_center[1] - y) / 0x800; } // Have two speed levels for accuracy and speed when wanted. if (fabs(y_off) < 0.5) y_off /= 50.0; else// if (fabs(y_off) < 1.0) y_off /= 10.0; if (fabs(x_off) < 0.5) x_off /= 50.0; else// if (fabs(x_off) < 1.0) x_off /= 10.0; #ifdef JOY_INVERT_Y task_data.x_offset = -y_off; #else task_data.x_offset = y_off; #endif #ifdef JOY_INVERT_X task_data.y_offset = -x_off; #else task_data.y_offset = x_off; #endif } if( current_jog_z ) { switch(current_jog_z) { case (1<<JOG_Z_UP_BIT): task_data.z_offset = 0.0003; break; case (1<<JOG_Z_DOWN_BIT): task_data.z_offset = -0.0003; break; default: task_data.z_offset = 0; } } if( enabled || current_jog_z ) { task_data.rate = 20000; task_enable(TASK_MANUAL_MOVE, &task_data); } if( enabled ) { // // Trigger the next ADC conversion. // if (status & STATUS_CH0_IDLE) ADCProcessorTrigger(ADC0_BASE, 0); if (status & STATUS_CH1_IDLE) ADCProcessorTrigger(ADC0_BASE, 1); } }