objc

Macros | Typedefs | Enumerations | Functions
power.h File Reference

Power management interface. More...

#include <runtime-sys/sys.h>
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for power.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HW_POWER_CTX_SIZE   64
 Size (bytes) of the power context.
 

Typedefs

typedef struct hw_power_t hw_power_t
 
typedef void(* hw_power_callback_t) (hw_power_t *power, hw_power_flag_t flags, uint32_t value, void *user_data)
 Power status callback prototype. More...
 

Enumerations

enum  hw_power_flag_t { HW_POWER_UNKNOWN = 0, HW_POWER_USB = (1 << 0), HW_POWER_BATTERY = (1 << 1), HW_POWER_RESET = (1 << 2) }
 Power source capability / status flags. More...
 

Functions

hw_power_t * hw_power_init (uint8_t gpio_vsys, uint8_t gpio_vbus, hw_power_callback_t callback, void *user_data)
 Initialize power management. More...
 
bool hw_power_valid (hw_power_t *power)
 Determine if the power handle is initialized and usable. More...
 
void hw_power_finalize (hw_power_t *power)
 Finalize and release any resources. More...
 
uint8_t hw_power_battery_percent (hw_power_t *power)
 Approximate battery state of charge. More...
 
hw_power_flag_t hw_power_source (hw_power_t *power)
 Current detected power source(s). More...
 

Detailed Description

Power management interface.

Definition in file power.h.