1#ifndef POWER_MANAGEMENTH
2#define POWER_MANAGEMENTH
22#define WIRC_H_ADDRESS 0xf8
29#define WIRC_L_ADDRESS 0xf9
42#define WAKEUP_DEFAULT_FREQ 32768U
56#define idle() (bit_set(PCON, SBIT0))
69 bit_set(PCON, SBIT1); \
86#define wakeup_timer_init(ticks) \
88 WKTCH = (ticks >> 8) | 0x80; \
89 WKTCL = ticks & 0xff; \
117#define wakeup_timer_init_seconds(seconds) \
119 uint16_t wakeup_freq = wakeup_timer_internal_clk_freq(); \
120 if (!wakeup_freq) { wakeup_freq = WAKEUP_DEFAULT_FREQ; } \
121 uint16_t timer_ticks = seconds * (wakeup_freq >> 4); \
122 wakeup_timer_init(timer_ticks); \
125static volatile __idata uint8_t *
const wirc_h_ptr = (__idata uint8_t *)
WIRC_H_ADDRESS;
126static volatile __idata uint8_t *
const wirc_l_ptr = (__idata uint8_t *)
WIRC_L_ADDRESS;
145#define wakeup_timer_internal_clk_freq() (((uint16_t)*wirc_h_ptr << 8) | *wirc_l_ptr)
161#define get_power_low_voltage_flag() (get_bit(PCON, 5))
172#define clear_power_low_voltage_flag() (bit_clr(PCON, CBIT5))
#define WIRC_L_ADDRESS
Wakeup timer internal clock frequency value low byte address.
Definition power_management.h:29
#define WIRC_H_ADDRESS
Wakeup timer internal clock frequency value high byte address.
Definition power_management.h:22