Contiki-NG
|
Driver control the power management of the RE-Mote rev B platform. More...
Files | |
file | power-mgmt.h |
Header file for the RE-Mote Power Management driver. | |
file | power-mgmt.h |
Header file for the RE-Mote Power Management driver. | |
Power management controller | |
#define | PWR_MNGMT_ADDR 0x7F |
Power Management slave address. | |
Power Management return values | |
#define | PM_SUCCESS 0 |
#define | PM_ERROR (-1) |
Power Management Registers | |
enum | pm_registers_t |
Power Management status and masks | |
enum | pm_charge_current_states |
#define | PM_ENABLE 1 /* Pin status on */ |
#define | PM_DISABLE 0 /* Pin status off */ |
#define | BATT_CHARGED_VAL 0 |
#define | BATT_UNCHARGED_VAL 1 |
#define | PM_REFERENCE_INTERNAL 0 |
#define | PM_REFERENCE_EXTERNAL 1 |
#define | PM_SOFT_SHTDN_INTERVAL 5720 |
#define | PM_SOFT_SHTDN_0_5_SEC 8 |
#define | PM_SOFT_SHTDN_1_SEC 17 |
#define | PM_SOFT_SHTDN_1_4_SEC 25 |
#define | PM_SOFT_SHTDN_5_7_SEC 100 |
#define | PM_SOFT_SHTDN_30_SEC 524 |
#define | PM_SOFT_SHTDN_1_MIN 1049 |
#define | PM_SOFT_SHTDN_5_MIN 5245 |
#define | PM_SOFT_SHTDN_10_MIN 10490 |
#define | PM_SOFT_SHTDN_1_H 62937 |
#define | PM_SOFT_SHTDN_24_H 1510490 |
#define | PM_SOFT_SHTDN_7_DAYS 10573427 |
#define | PM_SOFT_SHTDN_14_DAYS 21146853 |
#define | PM_SOFT_SHTDN_28_DAYS 42383709 |
#define | PM_SOFT_SHTDN_TEST 0xCC00FFEE |
#define | PM_VBAT_MULT (float)-181.9 |
#define | PM_VBAT_OFF (float)1294.72 |
Power Management functions | |
int8_t | pm_enable (void) |
Initializes the Power Management driver. More... | |
int8_t | pm_reset_system (void) |
Restarts the on-board low-power PIC, provoking a board reset. More... | |
int8_t | pm_set_timeout (uint32_t time) |
Configure Internal Timeout for Hard and Soft shutdown modes. More... | |
uint32_t | pm_get_timeout (void) |
Gets the current timeout value configured in power management module. More... | |
uint32_t | pm_get_num_cycles (void) |
Gets current cycles. More... | |
int8_t | pm_shutdown_now (uint8_t type) |
Disconnects the board battery and enter shutdown mode PM_SOFT/HARD_SLEEP_CONFIG. More... | |
int8_t | pm_get_voltage (uint16_t *state) |
Reads the voltage of the external battery if connected to VIN pin. More... | |
int8_t | pm_get_fw_ver (uint8_t *fwver) |
Gets the current firmware version of power management module. More... | |
Driver control the power management of the RE-Mote rev B platform.
RE-Mote power management functions.
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.
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.
uint32_t pm_get_num_cycles | ( | void | ) |
Gets current cycles.
incremented each shutdown cycle
Definition at line 203 of file power-mgmt.c.
uint32_t pm_get_timeout | ( | void | ) |
Gets the current timeout value configured in power management module.
Definition at line 180 of file power-mgmt.c.
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 |
Definition at line 250 of file power-mgmt.c.
int8_t pm_reset_system | ( | void | ) |
Restarts the on-board low-power PIC, provoking a board reset.
Definition at line 128 of file power-mgmt.c.
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 |
Definition at line 149 of file power-mgmt.c.
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.