Contiki-NG
|
Files | |
file | power-mgmt.h |
Header file for the RE-Mote Power Management driver. | |
Functions | |
static int | pm_write_byte (uint8_t reg, uint8_t val) |
static int | pm_read_byte (uint8_t reg, uint8_t *val, uint8_t len) |
Power Management functions | |
int8_t | pm_enable (void) |
Initializes the Power Management driver. | |
int8_t | pm_reset_system (void) |
Restarts the on-board low-power PIC, provoking a board reset. | |
int8_t | pm_set_timeout (uint32_t time) |
Configure Internal Timeout for Hard and Soft shutdown modes. | |
uint32_t | pm_get_timeout (void) |
Gets the current timeout value configured in power management module. | |
uint32_t | pm_get_num_cycles (void) |
Gets current cycles. | |
int8_t | pm_shutdown_now (uint8_t type) |
Disconnects the board battery and enter shutdown mode PM_SOFT/HARD_SLEEP_CONFIG. | |
int8_t | pm_get_voltage (uint16_t *state) |
Reads the voltage of the external battery if connected to VIN pin. | |
int8_t | pm_get_fw_ver (uint8_t *fwver) |
Gets the current firmware version of power management module. | |
Power management controller | |
#define | PWR_MNGMT_ADDR 0x7F |
Power Management slave address. | |
RE-Mote power management functions.
Driver control the power management of the RE-Mote rev B platform. This driver is an I2C communication with external power manager chip that controls few functions of the board. Note the driver will work if powered both over USB and external battery, but the shutdown mode will only be actually working with external battery
int8_t pm_enable | ( | void | ) |
Initializes the Power Management driver.
Definition at line 74 of file power-mgmt.c.
References GPIO_SOFTWARE_CONTROL, and i2c_init().
int8_t pm_get_fw_ver | ( | uint8_t * | fwver | ) |
Gets the current firmware version of power management module.
fwver | pointer to get the value of firmware |
Definition at line 280 of file power-mgmt.c.
References pm_read_byte().
uint32_t pm_get_num_cycles | ( | void | ) |
Gets current cycles.
incremented each shutdown cycle
< Power Management slave address
< Power Management slave address
Definition at line 203 of file power-mgmt.c.
References i2c_burst_receive(), i2c_single_send(), and PWR_MNGMT_ADDR.
uint32_t pm_get_timeout | ( | void | ) |
Gets the current timeout value configured in power management module.
< Power Management slave address
< Power Management slave address
Definition at line 180 of file power-mgmt.c.
References i2c_burst_receive(), i2c_single_send(), and PWR_MNGMT_ADDR.
int8_t pm_get_voltage | ( | uint16_t * | state | ) |
Reads the voltage of the external battery if connected to VIN pin.
state | pointer to get the voltage value |
< Power Management slave address
< Power Management slave address
Definition at line 250 of file power-mgmt.c.
References i2c_burst_receive(), i2c_single_send(), and PWR_MNGMT_ADDR.
|
static |
< Power Management slave address
< Power Management slave address
Definition at line 105 of file power-mgmt.c.
References i2c_burst_receive(), i2c_single_send(), and PWR_MNGMT_ADDR.
Referenced by pm_get_fw_ver().
int8_t pm_reset_system | ( | void | ) |
Restarts the on-board low-power PIC, provoking a board reset.
< Power Management slave address
Definition at line 128 of file power-mgmt.c.
References clock_delay_usec(), i2c_burst_send(), and PWR_MNGMT_ADDR.
int8_t pm_set_timeout | ( | uint32_t | time | ) |
Configure Internal Timeout for Hard and Soft shutdown modes.
In Hard mode, any positive value counts as internal security timeout. In Soft mode, this value is needed.
time | value as timeout maximum |
< Power Management slave address
Definition at line 149 of file power-mgmt.c.
References i2c_burst_send(), and PWR_MNGMT_ADDR.
int8_t pm_shutdown_now | ( | uint8_t | type | ) |
Disconnects the board battery and enter shutdown mode PM_SOFT/HARD_SLEEP_CONFIG.
type | Hard shutdown (RTCC based) or soft (PIC-governed) |
Definition at line 223 of file power-mgmt.c.
References pm_write_byte().
|
static |
< Power Management slave address
Definition at line 87 of file power-mgmt.c.
References i2c_burst_send(), and PWR_MNGMT_ADDR.
Referenced by pm_shutdown_now().