1#ifndef POWER_MANAGEMENTH
2#define POWER_MANAGEMENTH
21#define WIRC_H_ADDRESS 0xf8
28#define WIRC_L_ADDRESS 0xf9
41#define WAKEUP_DEFAULT_FREQ 32768U
55#define idle() (bit_set(PCON, SBIT0))
68 bit_set(PCON, SBIT1); \
85#define wakeup_timer_init(ticks) \
87 WKTCH = (ticks >> 8) | 0x80; \
88 WKTCL = ticks & 0xff; \
116#define wakeup_timer_init_seconds(seconds) \
118 uint16_t wakeup_freq = wakeup_timer_internal_clk_freq(); \
119 if (!wakeup_freq) { wakeup_freq = WAKEUP_DEFAULT_FREQ; } \
120 uint16_t timer_ticks = seconds * (wakeup_freq >> 4); \
121 wakeup_timer_init(timer_ticks); \
124static volatile __idata uint8_t *
const wirc_h_ptr = (__idata uint8_t *)
WIRC_H_ADDRESS;
125static volatile __idata uint8_t *
const wirc_l_ptr = (__idata uint8_t *)
WIRC_L_ADDRESS;
144#define wakeup_timer_internal_clk_freq() (((uint16_t)*wirc_h_ptr << 8) | *wirc_l_ptr)
160#define get_power_low_voltage_flag() (test_if_bit_set(PCON, 5))
171#define clear_power_low_voltage_flag() (bit_clr(PCON, SBIT5))
#define WIRC_L_ADDRESS
Wakeup timer internal clock frequency value low byte address.
Definition power_management.h:28
#define WIRC_H_ADDRESS
Wakeup timer internal clock frequency value high byte address.
Definition power_management.h:21