battery_gauge:add poll support

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao
2021-10-08 15:41:03 +08:00
committed by Xiang Xiao
parent 0d95d6fa45
commit ef7c61ae2d
3 changed files with 217 additions and 8 deletions
+10
View File
@@ -29,6 +29,7 @@
#include <nuttx/config.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/semaphore.h>
#include <nuttx/list.h>
#include <stdbool.h>
#include <fixedmath.h>
@@ -109,6 +110,8 @@ struct battery_gauge_dev_s
FAR const struct battery_gauge_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 */
};
@@ -130,6 +133,13 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: battery_gauge_changed
****************************************************************************/
int battery_gauge_changed(FAR struct battery_gauge_dev_s *dev,
uint32_t mask);
/****************************************************************************
* Name: battery_gauge_register
*
+2 -1
View File
@@ -68,7 +68,8 @@
#define BATTERY_ONLINE_CHANGED (1U << 2)
#define BATTERY_VOLTAGE_CHANGED (1U << 3)
#define BATTERY_CURRENT_CHANGED (1U << 4)
#define BATTERY_INPUT_CURRENT_CHANGED (1U << 5)
#define BATTERY_CAPACITY_CHANGED (1U << 5)
#define BATTERY_TEMPERATURE_CHANGED (1U << 6)
/****************************************************************************
* Public Types