nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
adp536x.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef ADP536X_H_
8#define ADP536X_H_
9
17#include <stdint.h>
18#include <stdbool.h>
19
20#include <zephyr/device.h>
21
22/* Definition of VBUS current limit values. */
23#define ADP536X_VBUS_ILIM_50mA 0x00
24#define ADP536X_VBUS_ILIM_100mA 0x01
25#define ADP536X_VBUS_ILIM_150mA 0x02
26#define ADP536X_VBUS_ILIM_200mA 0x03
27#define ADP536X_VBUS_ILIM_250mA 0x04
28#define ADP536X_VBUS_ILIM_300mA 0x05
29#define ADP536X_VBUS_ILIM_400mA 0x06
30#define ADP536X_VBUS_ILIM_500mA 0x07
31
32/* Definition of charging current values. */
33#define ADP536X_CHG_CURRENT_10mA 0x00
34#define ADP536X_CHG_CURRENT_50mA 0x04
35#define ADP536X_CHG_CURRENT_100mA 0x09
36#define ADP536X_CHG_CURRENT_150mA 0x0E
37#define ADP536X_CHG_CURRENT_200mA 0x13
38#define ADP536X_CHG_CURRENT_250mA 0x18
39#define ADP536X_CHG_CURRENT_300mA 0x1D
40#define ADP536X_CHG_CURRENT_320mA 0x1F
41
42/* Definition of overcharge protection threshold values. */
43#define ADP536X_OC_CHG_THRESHOLD_25mA 0x00
44#define ADP536X_OC_CHG_THRESHOLD_50mA 0x01
45#define ADP536X_OC_CHG_THRESHOLD_100mA 0x02
46#define ADP536X_OC_CHG_THRESHOLD_150mA 0x03
47#define ADP536X_OC_CHG_THRESHOLD_200mA 0x04
48#define ADP536X_OC_CHG_THRESHOLD_250mA 0x05
49#define ADP536X_OC_CHG_THRESHOLD_300mA 0x06
50#define ADP536X_OC_CHG_THRESHOLD_400mA 0x07
51
57
63
72int adp536x_init(const struct device *dev);
73
82int adp536x_vbus_current_set(uint8_t value);
83
92int adp536x_charger_current_set(uint8_t value);
93
106
115int adp536x_charging_enable(bool enable);
116
126
136
146
156
164
173int adp536x_oc_chg_current_set(uint8_t value);
174
184
192int adp536x_fg_soc(uint8_t *percentage);
193
201int adp536x_fg_volts(uint16_t *millivolts);
202
205#endif /* ADP536X_H_ */
int adp536x_charger_current_set(uint8_t value)
Set the charger current.
int adp536x_charger_termination_voltage_set(uint8_t value)
Set the charger termination voltage.
int adp536x_oc_chg_current_set(uint8_t value)
Set the charge over-current threshold.
int adp536x_vbus_current_set(uint8_t value)
Set the VBUS current limit.
int adp536x_oc_chg_hiccup_set(bool enable)
Enable charge hiccup protection mode.
int adp536x_charging_enable(bool enable)
Enable charging.
int adp536x_factory_reset(void)
Reset the device to its default values.
int adp536x_fg_volts(uint16_t *millivolts)
Read battery voltage.
int adp536x_fg_soc(uint8_t *percentage)
Read battery state of charge.
int adp536x_charger_status_1_read(uint8_t *buf)
Read the STATUS1 register.
int adp536x_init(const struct device *dev)
Initialize ADP536X.
int adp536x_fg_set_mode(enum adp536x_fg_enabled en, enum adp536x_fg_mode mode)
Set Fuel Gauge operating mode.
adp536x_fg_enabled
Definition adp536x.h:53
@ ADP566X_FG_DISABLED
Definition adp536x.h:54
@ ADP566X_FG_ENABLED
Definition adp536x.h:55
int adp536x_oc_dis_hiccup_set(bool enable)
Enable discharge hiccup protection mode.
adp536x_fg_mode
Definition adp536x.h:59
@ ADP566X_FG_MODE_SLEEP
Definition adp536x.h:61
@ ADP566X_FG_MODE_ACTIVE
Definition adp536x.h:60
int adp536x_charger_status_2_read(uint8_t *buf)
Read the STATUS2 register.