void GPIOIntHandler(void) { unsigned long ulHall, ulPWM; // // Clear the GPIO pin interrupts. // GPIOPinIntClear(HALL_PORT, HALL_A | HALL_B | HALL_C); // // Perform commutation if the motor is running. // if(g_iRunning == MOTOR_RUNNING) { // // Get the current Hall effect sensor state. // ulHall = (GPIOPinRead(HALL_PORT, HALL_A | HALL_B | HALL_C) >> HALL_SHIFT); // // Get the set of PWM signals to be driven. // ulPWM = pulHallToPhase[ulHall]; // // Set the PWM signals to be driven. // PWMOutputState(PWM_BASE, ulPWM ^ (PHASE_A | PHASE_B | PHASE_C), false); PWMOutputState(PWM_BASE, ulPWM, true); } }