battery_monitor:add poll support

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao
2021-10-08 16:13:11 +08:00
committed by Xiang Xiao
parent ef7c61ae2d
commit 1623848720
3 changed files with 216 additions and 10 deletions
+3 -1
View File
@@ -69,7 +69,9 @@
#define BATTERY_VOLTAGE_CHANGED (1U << 3)
#define BATTERY_CURRENT_CHANGED (1U << 4)
#define BATTERY_CAPACITY_CHANGED (1U << 5)
#define BATTERY_TEMPERATURE_CHANGED (1U << 6)
#define BATTERY_CELLVOLTAGE_CHANGED (1U << 6)
#define BATTERY_TEMPERATURE_CHANGED (1U << 7)
#define BATTERY_COULOMBS_CHANGED (1U << 8)
/****************************************************************************
* Public Types
+10
View File
@@ -28,6 +28,7 @@
#include <nuttx/config.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/list.h>
#include <stdbool.h>
#include <stdint.h>
@@ -296,6 +297,8 @@ struct battery_monitor_dev_s
FAR const struct battery_monitor_operations_s *ops; /* Battery operations */
sem_t batsem; /* Enforce mutually exclusive access */
struct list_node flist;
/* Data fields specific to the lower-half driver may follow */
};
@@ -317,6 +320,13 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: battery_monitor_changed
****************************************************************************/
int battery_monitor_changed(FAR struct battery_monitor_dev_s *dev,
uint32_t mask);
/****************************************************************************
* Name: battery_monitor_register
*