fn TIMER2() {
    free(|cs| {
        access_global!(COOL_THRESH_TIMER, cool_thresh_timer, cs);
        cool_thresh_timer.clear_interrupt(0);
        COOL_THRESH_TIMER_RUNNING.store(false, Ordering::Release);

        OP_MODE.borrow(cs).set(OpMode::Idle);
        access_global!(RTC, rtc, cs);
        rtc.set_compare(
            RtcCompareReg::Compare0,
            (LFCLK_FREQ as f32 * SLEEP_TIME_IDLE) as u32,
        )
        .unwrap();

        if SENSOR_SLEEPING.swap(true, Ordering::Relaxed) {
            access_global!(TWIM, twim, cs);
            access_global!(SCL, scl, cs);
            sensor::sleep(twim, scl);
        } else {
            SENSOR_SLEEPING.store(false, Ordering::Relaxed);
        }
    });
}
/// ISR for the cool thresh timer. When a temperature reading is below the threshhold, this timer
/// starts. When it times out, this ISR runs, putting the sensor and MCU in low-power modes.
ISR for the cool thresh timer. When a temperature reading is below the threshhold, this timer
starts. When it times out, this ISR runs, putting the sensor and MCU in low-power modes.
ISR for the cool thresh timer . When a temperature reading is below the threshhold this timer starts . When it times out this ISR runs putting the sensor and MCU in low - power modes .
fn TIMER2() {
    free(|cs| {
        access_global!(COOL_THRESH_TIMER, cool_thresh_timer, cs);
        cool_thresh_timer.clear_interrupt(0);
        COOL_THRESH_TIMER_RUNNING.store(false, Ordering::Release);
        OP_MODE.borrow(cs).set(OpMode::Idle);
        access_global!(RTC, rtc, cs);
        rtc.set_compare(
            RtcCompareReg::Compare0,
            (LFCLK_FREQ as f32 * SLEEP_TIME_IDLE) as u32,
        )
        .unwrap();
        if SENSOR_SLEEPING.swap(true, Ordering::Relaxed) {
            access_global!(TWIM, twim, cs);
            access_global!(SCL, scl, cs);
            sensor::sleep(twim, scl);
        } else {
            SENSOR_SLEEPING.store(false, Ordering::Relaxed);
        }
    });
}
fn TIMER2 ( ) { free ( | cs | { access_global ! ( COOL_THRESH_TIMER cool_thresh_timer cs ) ; cool_thresh_timer . clear_interrupt ( 0 ) ; COOL_THRESH_TIMER_RUNNING . store ( false , Ordering :: Release ) ; OP_MODE . borrow ( cs ) . set ( OpMode :: Idle ) ; access_global ! ( RTC rtc cs ) ; rtc . set_compare ( RtcCompareReg :: Compare0 , ( LFCLK_FREQ as f32 * SLEEP_TIME_IDLE ) as u32 , ) . unwrap ( ) ; if SENSOR_SLEEPING . swap ( true , Ordering :: Relaxed ) { access_global ! ( TWIM twim cs ) ; access_global ! ( SCL scl cs ) ; sensor :: sleep ( twim , scl ) ; } else { SENSOR_SLEEPING . store ( false , Ordering :: Relaxed ) ; } } ) ; }
ISR for the cool thresh timer.
ISR for the cool thresh timer .