drivers: sensor: ccs811: provide API to fetch configuration and versions
The application may want to know the configured mode without inspecting Kconfig macros; this is important for proper management of BASELINE which is mode-dependent. It also may need to know the version of the hardware and firmware, as the behavior of application firmware 2.0 is significantly better than version 1.1. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
2dd990ad55
commit
ac5acb9530
3 changed files with 74 additions and 2 deletions
|
@ -42,6 +42,7 @@ extern "C" {
|
|||
#define CCS811_MODE_IAQ_10SEC 0x20
|
||||
#define CCS811_MODE_IAQ_60SEC 0x30
|
||||
#define CCS811_MODE_IAQ_250MSEC 0x40
|
||||
#define CCS811_MODE_MSK 0x70
|
||||
|
||||
/** @brief Information collected from the sensor on each fetch. */
|
||||
struct ccs811_result_type {
|
||||
|
@ -81,6 +82,31 @@ struct ccs811_result_type {
|
|||
*/
|
||||
const struct ccs811_result_type *ccs811_result(struct device *dev);
|
||||
|
||||
/**
|
||||
* @brief Get information about static CCS811 state.
|
||||
*
|
||||
* This includes the configured operating mode as well as hardware and
|
||||
* firmware versions.
|
||||
*/
|
||||
struct ccs811_configver_type {
|
||||
u16_t fw_boot_version;
|
||||
u16_t fw_app_version;
|
||||
u8_t hw_version;
|
||||
u8_t mode;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Fetch operating mode and version information.
|
||||
*
|
||||
* @param dev Pointer to the sensor device
|
||||
*
|
||||
* @param ptr Pointer to where the returned information should be stored
|
||||
*
|
||||
* @return 0 on success, or a negative errno code on failure.
|
||||
*/
|
||||
int ccs811_configver_fetch(struct device *dev,
|
||||
struct ccs811_configver_type *ptr);
|
||||
|
||||
/**
|
||||
* @brief Fetch the current value of the BASELINE register.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue