LibDriver CCS811
Loading...
Searching...
No Matches
driver_ccs811.h File Reference

driver ccs811 header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_ccs811.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ccs811_handle_s
 ccs811 handle structure definition More...
struct  ccs811_info_s
 ccs811 information structure definition More...

Macros

#define DRIVER_CCS811_LINK_INIT(HANDLE, STRUCTURE)
 initialize ccs811_handle_t structure
#define DRIVER_CCS811_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_CCS811_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_CCS811_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_CCS811_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_CCS811_LINK_GPIO_WAKE_INIT(HANDLE, FUC)
 link gpio_wake_init function
#define DRIVER_CCS811_LINK_GPIO_WAKE_DEINIT(HANDLE, FUC)
 link gpio_wake_deinit function
#define DRIVER_CCS811_LINK_GPIO_WAKE_WRITE(HANDLE, FUC)
 link gpio_wake_write function
#define DRIVER_CCS811_LINK_GPIO_RESET_INIT(HANDLE, FUC)
 link gpio_reset_init function
#define DRIVER_CCS811_LINK_GPIO_RESET_DEINIT(HANDLE, FUC)
 link gpio_reset_deinit function
#define DRIVER_CCS811_LINK_GPIO_RESET_WRITE(HANDLE, FUC)
 link gpio_reset_write function
#define DRIVER_CCS811_LINK_BIN_READ_INIT(HANDLE, FUC)
 link bin_read_init function
#define DRIVER_CCS811_LINK_BIN_READ_DEINIT(HANDLE, FUC)
 link bin_read_deinit function
#define DRIVER_CCS811_LINK_BIN_READ(HANDLE, FUC)
 link bin_read function
#define DRIVER_CCS811_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_CCS811_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct ccs811_handle_s ccs811_handle_t
 ccs811 handle structure definition
typedef struct ccs811_info_s ccs811_info_t
 ccs811 information structure definition

Enumerations

enum  ccs811_address_t { CCS811_ADDRESS_GND = (0x5A << 1) , CCS811_ADDRESS_VCC = (0x5B << 1) }
 ccs811 address enumeration definition More...
enum  ccs811_bool_t { CCS811_BOOL_FALSE = 0x00 , CCS811_BOOL_TRUE = 0x01 }
 ccs811 bool enumeration definition More...
enum  ccs811_mode_t {
  CCS811_MODE_IDLE = 0x00 , CCS811_MODE_CONSTANT_POWER = 0x01 , CCS811_MODE_PULSE_HEATING = 0x02 , CCS811_MODE_LOW_POWER_PULSE_HEATING = 0x03 ,
  CCS811_MODE_HIGH_CONSTANT_POWER = 0x04
}
 ccs811 mode enumeration definition More...
enum  ccs811_status_t { CCS811_STATUS_FW_MODE = (1 << 7) , CCS811_STATUS_APP_VALID = (1 << 4) , CCS811_STATUS_DATA_READY = (1 << 3) , CCS811_STATUS_ERROR = (1 << 0) }
 ccs811 status enumeration definition More...
enum  ccs811_interrupt { CCS811_INTERRUPT_READY = 0x03 , CCS811_INTERRUPT_THRESHOLD = 0x02 }
 ccs811 interrupt enumeration definition More...
enum  ccs811_error_t {
  CCS811_ERROR_WRITE_REG_INVALID = (1 << 0) , CCS811_ERROR_READ_REG_INVALID = (1 << 1) , CCS811_ERROR_MEASMODE_INVALID = (1 << 2) , CCS811_ERROR_MAX_RESISTANCE = (1 << 3) ,
  CCS811_ERROR_HEATER_FAULT = (1 << 4) , CCS811_ERROR_HEATER_SUPPLY = (1 << 5)
}
 ccs811 error enumeration definition More...

Functions

uint8_t ccs811_info (ccs811_info_t *info)
 get chip information
uint8_t ccs811_set_addr_pin (ccs811_handle_t *handle, ccs811_address_t addr_pin)
 set address pin
uint8_t ccs811_get_addr_pin (ccs811_handle_t *handle, ccs811_address_t *addr_pin)
 get address pin
uint8_t ccs811_init (ccs811_handle_t *handle)
 initialize the chip
uint8_t ccs811_deinit (ccs811_handle_t *handle)
 close the chip
uint8_t ccs811_read (ccs811_handle_t *handle, uint16_t *eco2_ppm, uint16_t *tvoc_ppb, uint16_t *raw)
 read data
uint8_t ccs811_get_raw_data (ccs811_handle_t *handle, uint16_t *raw, uint8_t *ua, uint16_t *adc_raw, float *adc_v)
 get raw data
uint8_t ccs811_get_status (ccs811_handle_t *handle, uint8_t *status)
 get status
uint8_t ccs811_set_mode (ccs811_handle_t *handle, ccs811_mode_t mode)
 set mode
uint8_t ccs811_get_mode (ccs811_handle_t *handle, ccs811_mode_t *mode)
 get mode
uint8_t ccs811_set_interrupt_data_ready (ccs811_handle_t *handle, ccs811_bool_t enable)
 enable or disable interrupt data ready
uint8_t ccs811_get_interrupt_data_ready (ccs811_handle_t *handle, ccs811_bool_t *enable)
 get interrupt data ready status
uint8_t ccs811_set_interrupt_threshold (ccs811_handle_t *handle, ccs811_bool_t enable)
 enable or disable interrupt threshold
uint8_t ccs811_get_interrupt_threshold (ccs811_handle_t *handle, ccs811_bool_t *enable)
 get interrupt threshold status
uint8_t ccs811_set_environment_data (ccs811_handle_t *handle, uint16_t humidity_raw, uint16_t temperature_raw)
 set environment data
uint8_t ccs811_set_eco2_threshold (ccs811_handle_t *handle, uint16_t low_medium_ppm, uint16_t medium_high_ppm, uint8_t hysteresis)
 set eco2 threshold
uint8_t ccs811_set_baseline (ccs811_handle_t *handle, uint16_t baseline)
 set baseline
uint8_t ccs811_get_baseline (ccs811_handle_t *handle, uint16_t *baseline)
 get baseline
uint8_t ccs811_get_error_id (ccs811_handle_t *handle, uint8_t *id)
 get error id
uint8_t ccs811_get_hardware_id (ccs811_handle_t *handle, uint8_t *id)
 get hardware id
uint8_t ccs811_get_hardware_version (ccs811_handle_t *handle, uint8_t *version)
 get hardware version
uint8_t ccs811_get_firmware_bootloader_version (ccs811_handle_t *handle, uint8_t *major, uint8_t *minor, uint8_t *trivial)
 get firmware bootloader version
uint8_t ccs811_get_firmware_application_version (ccs811_handle_t *handle, uint8_t *major, uint8_t *minor, uint8_t *trivial)
 get firmware application version
uint8_t ccs811_soft_reset (ccs811_handle_t *handle)
 soft reset
uint8_t ccs811_wake_up (ccs811_handle_t *handle, ccs811_bool_t enable)
 wake up
uint8_t ccs811_hard_reset (ccs811_handle_t *handle)
 hard reset
uint8_t ccs811_environment_humidity_convert_to_register (ccs811_handle_t *handle, float humidity, uint16_t *reg)
 convert real data format to register data format
uint8_t ccs811_environment_humidity_convert_to_data (ccs811_handle_t *handle, uint16_t reg, float *humidity)
 convert register data to real data format
uint8_t ccs811_environment_temperature_convert_to_register (ccs811_handle_t *handle, float temperature, uint16_t *reg)
 convert real data format to register data format
uint8_t ccs811_environment_temperature_convert_to_data (ccs811_handle_t *handle, uint16_t reg, float *temperature)
 convert register data to real data format
uint8_t ccs811_app_erase (ccs811_handle_t *handle)
 app erase
uint8_t ccs811_app_verify (ccs811_handle_t *handle)
 app verify
uint8_t ccs811_app_start (ccs811_handle_t *handle)
 app start
uint8_t ccs811_app_program (ccs811_handle_t *handle, uint8_t *rom, uint32_t len)
 app program
uint8_t ccs811_app_firmware_init (ccs811_handle_t *handle)
 app firmware initialize
uint8_t ccs811_app_firmware_update (ccs811_handle_t *handle, char *path)
 app firmware update
uint8_t ccs811_set_reg (ccs811_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t ccs811_get_reg (ccs811_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver ccs811 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2025-06-30

history

Date Version Author Description
2025/06/30 1.0 Shifeng Li first upload

Definition in file driver_ccs811.h.