Loading...
Searching...
No Matches
bq2429x.h File Reference

Device driver interface for the BQ2429x Single-Cell USB Charger. More...

Detailed Description

Device driver interface for the BQ2429x Single-Cell USB Charger.

Author
Jean Pierre Dudey jeand.nosp@m.udey.nosp@m.@hotm.nosp@m.ail..nosp@m.com

Definition in file bq2429x.h.

#include <stdint.h>
#include <stdbool.h>
#include "kernel_defines.h"
#include "periph/i2c.h"
#include "periph/gpio.h"
+ Include dependency graph for bq2429x.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bq2429x_status_t
 Device status. More...
 
struct  bq2429x_fault_t
 Device faults. More...
 
struct  bq2429x_params_t
 BQ2429x device parameters. More...
 
struct  bq2429x_t
 BQ2429x device descriptor. More...
 

Typedefs

typedef void(* bq2429x_int_cb_t) (void *)
 Callback function for BQ2429x interrupts.
 

Enumerations

enum  { BQ2429X_OK = 0 , BQ2429X_ERR_I2C = -1 , BQ2429X_ERR_GPIO = -2 }
 Driver return values. More...
 
enum  bq2429x_vbus_stat_t { BQ2429X_VBUS_NONE = 0 , BQ2429X_VBUS_USB_CHARGER , BQ2429X_VBUS_AP_CHARGER , BQ2429X_VBUS_OTG }
 Used VBUS type. More...
 
enum  bq2429x_chrg_stat_t { BQ2429X_CHARGE_NONE = 0 , BQ2429X_CHARGE_PRE , BQ2429X_CHARGE_FAST , BQ2429X_CHARGE_DONE }
 Battery charging status. More...
 
enum  bq2429x_chrg_fault_t { BQ2429x_CHRG_FAULT_NORMAL = 0 , BQ2429x_CHRG_FAULT_INPUT , BQ2429x_CHRG_FAULT_THERMAL_SHUTDOWN , BQ2429x_CHRG_FAULT_CHARGE_TIMER_EXPIRATION }
 Charge fault values. More...
 
enum  bq2429x_input_voltage_limit_t {
  BQ2429X_VLIM_3880 = 0 , BQ2429X_VLIM_3960 , BQ2429X_VLIM_4040 , BQ2429X_VLIM_4120 ,
  BQ2429X_VLIM_4200 , BQ2429X_VLIM_4280 , BQ2429X_VLIM_4360 , BQ2429X_VLIM_4440 ,
  BQ2429X_VLIM_4520 , BQ2429X_VLIM_4600 , BQ2429X_VLIM_4680 , BQ2429X_VLIM_4760 ,
  BQ2429X_VLIM_4840 , BQ2429X_VLIM_4920 , BQ2429X_VLIM_5000 , BQ2429X_VLIM_5080
}
 Input Voltage Limit (VLIM). More...
 
enum  bq2429x_input_current_limit_t {
  BQ2429X_ILIM_100 = 0 , BQ2429X_ILIM_150 , BQ2429X_ILIM_500 , BQ2429X_ILIM_900 ,
  BQ2429X_ILIM_1000 , BQ2429X_ILIM_1500 , BQ2429X_ILIM_2000 , BQ2429X_ILIM_3000
}
 Input Current Limit (ILIM). More...
 
enum  bq2429x_charge_current_t {
  BQ2429X_ICHG_512 = 0 , BQ2429X_ICHG_1024 = 8 , BQ2429X_ICHG_2048 = 24 , BQ2429X_ICHG_3008 = 39 ,
  BQ2429X_ICHG_4032 = 55 , BQ2429X_ICHG_4544 = 63
}
 Charge Current (ICHG) More...
 
enum  bq2429x_charge_voltage_limit_t {
  BQ2429X_VREG_3504 = 0 , BQ2429X_VREG_3600 = 6 , BQ2429X_VREG_3808 = 19 , BQ2429X_VREG_3904 = 25 ,
  BQ2429X_VREG_4000 = 31 , BQ2429X_VREG_4112 = 38 , BQ2429X_VREG_4208 = 44 , BQ2429X_VREG_4304 = 50 ,
  BQ2429X_VREG_4352 = 53 , BQ2429X_VREG_4400 = 56
}
 Charge Voltage Limit (VREG). More...
 

Functions

int bq2429x_init (bq2429x_t *dev, const bq2429x_params_t *params)
 Initialize device.
 
int bq2429x_init_int (bq2429x_t *dev, bq2429x_int_cb_t cb, void *arg)
 Initialize interrupt support for the device.
 
int bq2429x_get_status (const bq2429x_t *dev, bq2429x_status_t *status)
 Get device status.
 
int bq2429x_get_fault (const bq2429x_t *dev, bq2429x_fault_t *fault)
 Get device faults.
 
int bq2429x_enable_otg (const bq2429x_t *dev)
 Enable OTG.
 
int bq2429x_disable_otg (const bq2429x_t *dev)
 Disable OTG.
 
int bq2429x_enable_charge (const bq2429x_t *dev)
 Enable battery charging.
 
int bq2429x_disable_charge (const bq2429x_t *dev)
 Disable battery charging.
 
int bq2429x_set_vlim (bq2429x_t *dev, bq2429x_input_voltage_limit_t vlim)
 Set Input Voltage Limit.
 
int bq2429x_get_vlim (const bq2429x_t *dev, bq2429x_input_voltage_limit_t *vlim)
 Get Input Voltage Limit.
 
int bq2429x_set_ilim (bq2429x_t *dev, bq2429x_input_current_limit_t ilim)
 Set Input Current Limit.
 
int bq2429x_get_ilim (const bq2429x_t *dev, bq2429x_input_current_limit_t *ilim)
 Get Input Current Limit.
 
int bq2429x_set_ichg (bq2429x_t *dev, bq2429x_charge_current_t ichg)
 Set Charge Current.
 
int bq2429x_get_ichg (const bq2429x_t *dev, bq2429x_charge_current_t *ichg)
 Get Charge Current.
 
int bq2429x_set_vreg (bq2429x_t *dev, bq2429x_charge_voltage_limit_t vreg)
 Set Charge Voltage Limit.
 
int bq2429x_get_vreg (const bq2429x_t *dev, bq2429x_charge_voltage_limit_t *vreg)
 Get Charge Voltage Limit.