LoRa-BLE-Sensor
Loading...
Searching...
No Matches
sensor_pmic.h
Go to the documentation of this file.
1
12#ifndef SENSOR_PMIC_H
13#define SENSOR_PMIC_H
14
15#include <zephyr/device.h>
16#include <stdbool.h>
17#include <stdint.h>
18#include <zephyr/drivers/sensor.h>
19
23typedef struct {
24 /* Battery percentage */
25 float percentage;
26 /* Battery voltage */
27 float voltage;
28 /* Battery current */
29 float current;
30 /* Battery temperature */
31 float temp;
32 /* Charger status */
33 uint32_t chg_status;
34 /* Charger error */
35 uint32_t chg_error;
36 /* VBUS present */
37 bool vbus_present;
39
43typedef struct {
44 /* Function pointer to check if the PMIC device is ready */
45 bool (*device_is_ready)(const struct device *dev);
46 /* Function pointer to turn on the LED */
47 int (*led_on)(const struct device *dev, uint32_t led);
48 /* Function pointer to turn off the LED */
49 int (*led_off)(const struct device *dev, uint32_t led);
50 /* Function pointer to get the status of the PMIC sensors */
51 int (*sensor_status_get)(const struct device *dev, pmic_sensor_status_t *status);
53
61
67int sensor_pmic_init(void);
68
74int sensor_pmic_led_on(void);
75
81int sensor_pmic_led_off(void);
82
90
91#endif
int sensor_pmic_status_get(pmic_sensor_status_t *status)
Get the status of the PMIC sensors.
Definition sensor_pmic.c:115
int sensor_pmic_led_off(void)
Turn off the LED.
Definition sensor_pmic.c:78
int sensor_pmic_init_with_ops(const sensor_pmic_ops_t *ops)
Initialize the PMIC with custom operations.
Definition sensor_pmic.c:41
int sensor_pmic_led_on(void)
Turn on the LED.
Definition sensor_pmic.c:73
int sensor_pmic_init(void)
Initialize the PMIC, with default operations.
Definition sensor_pmic.c:68
Structure for the PMIC sensor status.
Definition sensor_pmic.h:23
Structure containing function pointers for PMIC operations.
Definition sensor_pmic.h:43