// This function is used to shutdown everything exept USB // When this function return all the peripheral should be : // - Disabled // - In minimal power consuption mode void switch_off(void) { behavior_stop(B_ALL); timer_disable(TIMER_1KHZ); timer_disable_interrupt(TIMER_1KHZ); _LVDIE = 0; // Why waiting on valid vbat ? // => We use an aseba variable, the user may corrupt it wait_valid_vbat(); // ir autocalibration is using it. analog_disable(); pwm_motor_poweroff(); prox_poweroff(); save_settings(); sound_poweroff(); sd_shutdown(); leds_poweroff(); mma7660_suspend(); rf_poweroff(); I2C3CONbits.I2CEN = 0; // Disable i2c. _MI2C3IE = 0; ntc_shutdown(); rc5_shutdown(); CHARGE_500MA = 0; // TODO: Force VA ?! Check me that refcount is correct }
void hwtimer_arch_disable_interrupt(void) { for (int i = 0; i < HWTIMER_MAXTIMERS; i++) { timer_disable_interrupt(i); } }
void timer_unset(short timer) { volatile unsigned int *ptr = &CNT_COMP_BASE_REG + (timer); timer_disable_interrupt(timer); *ptr = 0; }