Loading...
Searching...
No Matches
bq2429x.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Locha Inc
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
50#ifndef BQ2429X_H
51#define BQ2429X_H
52
53#include <stdint.h>
54#include <stdbool.h>
55
56#include "kernel_defines.h"
57#include "periph/i2c.h"
58#include "periph/gpio.h"
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
67enum {
71};
72
82
93
125
136
175
197
211
223
239
255
259typedef struct {
261} bq2429x_t;
262
276int bq2429x_init(bq2429x_t *dev, const bq2429x_params_t *params);
277
278#if IS_USED(MODULE_BQ2429X_INT) || DOXYGEN
282typedef void (* bq2429x_int_cb_t)(void *);
283
302#endif /* IS_USED(MODULE_BQ2429X_INT) || DOXYGEN */
303
316
329
348
360
372
384
402
415
431
444
457
470
483
497
498#ifdef __cplusplus
499}
500#endif
501
502#endif /* BQ2429X_H */
Low-level GPIO peripheral driver interface definitions.
bq2429x_input_voltage_limit_t
Input Voltage Limit (VLIM).
Definition bq2429x.h:179
bq2429x_charge_voltage_limit_t
Charge Voltage Limit (VREG).
Definition bq2429x.h:227
int bq2429x_set_vreg(bq2429x_t *dev, bq2429x_charge_voltage_limit_t vreg)
Set Charge Voltage Limit.
int bq2429x_init(bq2429x_t *dev, const bq2429x_params_t *params)
Initialize device.
int bq2429x_get_vlim(const bq2429x_t *dev, bq2429x_input_voltage_limit_t *vlim)
Get Input Voltage Limit.
int bq2429x_enable_charge(const bq2429x_t *dev)
Enable battery charging.
int bq2429x_get_ilim(const bq2429x_t *dev, bq2429x_input_current_limit_t *ilim)
Get Input Current Limit.
int bq2429x_get_ichg(const bq2429x_t *dev, bq2429x_charge_current_t *ichg)
Get Charge Current.
bq2429x_chrg_fault_t
Charge fault values.
Definition bq2429x.h:129
bq2429x_chrg_stat_t
Battery charging status.
Definition bq2429x.h:86
int bq2429x_get_status(const bq2429x_t *dev, bq2429x_status_t *status)
Get device status.
int bq2429x_disable_charge(const bq2429x_t *dev)
Disable battery charging.
int bq2429x_get_vreg(const bq2429x_t *dev, bq2429x_charge_voltage_limit_t *vreg)
Get Charge Voltage Limit.
bq2429x_vbus_stat_t
Used VBUS type.
Definition bq2429x.h:76
int bq2429x_init_int(bq2429x_t *dev, bq2429x_int_cb_t cb, void *arg)
Initialize interrupt support for the device.
bq2429x_input_current_limit_t
Input Current Limit (ILIM).
Definition bq2429x.h:201
int bq2429x_disable_otg(const bq2429x_t *dev)
Disable OTG.
int bq2429x_set_ilim(bq2429x_t *dev, bq2429x_input_current_limit_t ilim)
Set Input Current Limit.
int bq2429x_set_vlim(bq2429x_t *dev, bq2429x_input_voltage_limit_t vlim)
Set Input Voltage Limit.
void(* bq2429x_int_cb_t)(void *)
Callback function for BQ2429x interrupts.
Definition bq2429x.h:282
int bq2429x_get_fault(const bq2429x_t *dev, bq2429x_fault_t *fault)
Get device faults.
int bq2429x_set_ichg(bq2429x_t *dev, bq2429x_charge_current_t ichg)
Set Charge Current.
int bq2429x_enable_otg(const bq2429x_t *dev)
Enable OTG.
bq2429x_charge_current_t
Charge Current (ICHG)
Definition bq2429x.h:215
@ BQ2429X_VLIM_5000
5000 mV
Definition bq2429x.h:194
@ BQ2429X_VLIM_4040
4040 mV
Definition bq2429x.h:182
@ BQ2429X_VLIM_3960
3960 mV
Definition bq2429x.h:181
@ BQ2429X_VLIM_4120
4120 mV
Definition bq2429x.h:183
@ BQ2429X_VLIM_4840
4840 mV
Definition bq2429x.h:192
@ BQ2429X_VLIM_4760
4760 mV
Definition bq2429x.h:191
@ BQ2429X_VLIM_4920
4920 mV
Definition bq2429x.h:193
@ BQ2429X_VLIM_4440
4440 mV
Definition bq2429x.h:187
@ BQ2429X_VLIM_4360
4360 mV
Definition bq2429x.h:186
@ BQ2429X_VLIM_4520
4520 mV
Definition bq2429x.h:188
@ BQ2429X_VLIM_4680
4680 mV
Definition bq2429x.h:190
@ BQ2429X_VLIM_4200
4200 mV
Definition bq2429x.h:184
@ BQ2429X_VLIM_4280
4280 mV
Definition bq2429x.h:185
@ BQ2429X_VLIM_3880
3880 mV
Definition bq2429x.h:180
@ BQ2429X_VLIM_4600
4600 mV
Definition bq2429x.h:189
@ BQ2429X_VLIM_5080
5080 mV
Definition bq2429x.h:195
@ BQ2429X_VREG_4112
4112 mV
Definition bq2429x.h:233
@ BQ2429X_VREG_4304
4304 mV
Definition bq2429x.h:235
@ BQ2429X_VREG_4208
4208 mV
Definition bq2429x.h:234
@ BQ2429X_VREG_3904
3904 mV
Definition bq2429x.h:231
@ BQ2429X_VREG_3808
3808 mV
Definition bq2429x.h:230
@ BQ2429X_VREG_4400
4400 mV
Definition bq2429x.h:237
@ BQ2429X_VREG_4000
4000 mV
Definition bq2429x.h:232
@ BQ2429X_VREG_4352
4352 mV
Definition bq2429x.h:236
@ BQ2429X_VREG_3600
3600 mV
Definition bq2429x.h:229
@ BQ2429X_VREG_3504
3504 mV
Definition bq2429x.h:228
@ BQ2429x_CHRG_FAULT_THERMAL_SHUTDOWN
Thermal shutdown.
Definition bq2429x.h:133
@ BQ2429x_CHRG_FAULT_NORMAL
No fault, normal.
Definition bq2429x.h:130
@ BQ2429x_CHRG_FAULT_INPUT
Input fault (OVP or bad source)
Definition bq2429x.h:131
@ BQ2429x_CHRG_FAULT_CHARGE_TIMER_EXPIRATION
Charge timer expiration.
Definition bq2429x.h:134
@ BQ2429X_CHARGE_NONE
The device is not charging a battery.
Definition bq2429x.h:87
@ BQ2429X_CHARGE_DONE
Charging done.
Definition bq2429x.h:91
@ BQ2429X_CHARGE_FAST
Fast charging.
Definition bq2429x.h:90
@ BQ2429X_CHARGE_PRE
Pre-charge state.
Definition bq2429x.h:89
@ BQ2429X_VBUS_NONE
No input source detected.
Definition bq2429x.h:77
@ BQ2429X_VBUS_USB_CHARGER
USB charger input.
Definition bq2429x.h:78
@ BQ2429X_VBUS_OTG
VBUS is used for OTG.
Definition bq2429x.h:80
@ BQ2429X_VBUS_AP_CHARGER
Adapter port charge input.
Definition bq2429x.h:79
@ BQ2429X_ERR_I2C
I2C error.
Definition bq2429x.h:69
@ BQ2429X_ERR_GPIO
GPIO initialization error.
Definition bq2429x.h:70
@ BQ2429X_OK
Everything is ok.
Definition bq2429x.h:68
@ BQ2429X_ILIM_1500
1500 mA
Definition bq2429x.h:207
@ BQ2429X_ILIM_3000
3000 mA
Definition bq2429x.h:209
@ BQ2429X_ILIM_1000
1000 mA
Definition bq2429x.h:206
@ BQ2429X_ILIM_900
900 mA
Definition bq2429x.h:205
@ BQ2429X_ILIM_150
150 mA
Definition bq2429x.h:203
@ BQ2429X_ILIM_2000
2000 mA
Definition bq2429x.h:208
@ BQ2429X_ILIM_500
500 mA
Definition bq2429x.h:204
@ BQ2429X_ILIM_100
100 mA
Definition bq2429x.h:202
@ BQ2429X_ICHG_2048
2048 mA
Definition bq2429x.h:218
@ BQ2429X_ICHG_512
512 mA
Definition bq2429x.h:216
@ BQ2429X_ICHG_1024
1024 mA
Definition bq2429x.h:217
@ BQ2429X_ICHG_4032
4544 mA
Definition bq2429x.h:220
@ BQ2429X_ICHG_3008
4032 mA
Definition bq2429x.h:219
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
Low-level I2C peripheral driver interface definition.
Common macros and compiler attributes/pragmas configuration.
Device faults.
Definition bq2429x.h:140
bool ntc_fault_1
NTC fault (1).
Definition bq2429x.h:167
bool watchdog
Watchdog fault.
Definition bq2429x.h:146
bool bat
Battery fault.
Definition bq2429x.h:161
bool ntc_fault_0
NTC fault (0).
Definition bq2429x.h:173
bool otg
OTG fault.
Definition bq2429x.h:153
bq2429x_chrg_fault_t chrg
Charge fault.
Definition bq2429x.h:157
BQ2429x device parameters.
Definition bq2429x.h:243
i2c_t i2c
I2C device.
Definition bq2429x.h:244
bq2429x_charge_current_t ichg
Charge current limit.
Definition bq2429x.h:252
bq2429x_charge_voltage_limit_t vreg
Charge voltage limit.
Definition bq2429x.h:253
gpio_t ce_pin
Charge Enable pin (optional)
Definition bq2429x.h:248
gpio_t otg_pin
OTG Enable pin (optional)
Definition bq2429x.h:249
bq2429x_input_current_limit_t ilim
Current limit.
Definition bq2429x.h:251
bq2429x_input_voltage_limit_t vlim
Voltage limit.
Definition bq2429x.h:250
Device status.
Definition bq2429x.h:97
bool pg
Power good status.
Definition bq2429x.h:111
bool vsys
VSYSMIN regulation.
Definition bq2429x.h:123
bool dpm
DPM status.
Definition bq2429x.h:105
bool therm
Thermal regulation.
Definition bq2429x.h:117
bq2429x_vbus_stat_t vbus
VBUS status.
Definition bq2429x.h:98
bq2429x_chrg_stat_t chrg
Charge status.
Definition bq2429x.h:99
BQ2429x device descriptor.
Definition bq2429x.h:259
bq2429x_params_t params
Device parameters.
Definition bq2429x.h:260