battery_charger:add poll support

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao
2021-09-29 10:56:56 +08:00
committed by Xiang Xiao
parent b9986ca016
commit 0d95d6fa45
3 changed files with 227 additions and 10 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>
@@ -127,6 +128,8 @@ struct battery_charger_dev_s
sem_t batsem; /* Enforce mutually exclusive access */
struct list_node flist;
/* Data fields specific to the lower-half driver may follow */
};
@@ -148,6 +151,13 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: battery_charger_changed
****************************************************************************/
int battery_charger_changed(FAR struct battery_charger_dev_s *dev,
uint32_t mask);
/****************************************************************************
* Name: battery_charger_register
*
+9
View File
@@ -61,6 +61,15 @@
#define BATTERY_INPUT_CURRENT_EXT_LIM (-1) /* External input current limit */
/* The change mask definition used to set the mask. */
#define BATTERY_STATE_CHANGED (1U << 0)
#define BATTERY_HEALTH_CHANGED (1U << 1)
#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)
/****************************************************************************
* Public Types
****************************************************************************/