Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CDM7160 Class Reference
Implementation of CDM7160 sensor CO2 library. More...
#include <CDM7160.h>
Data Structures | |
struct | cdm7160_t |
cdm7160 stuct prototype More... | |
Public Types | |
enum | eReg |
eReg read/write commands More... | |
enum | eControlMode |
Reg: CTL / Addr: 0x01 / Permission: RW / Bits:2-0. More... | |
enum | eFunctionSetting |
Reg: FUNC / Addr: 0x0F / Permission: RW / Bits: 3, 2, 0. More... | |
Public Member Functions | |
CDM7160 (PinName sda, PinName scl, uint8_t addr=CDM7160_I2C_ADDR) | |
Create an CDM7160 instance which is connected to specified I2C pins with specified address. | |
CDM7160 (I2C &i2c_obj, uint8_t addr=CDM7160_I2C_ADDR) | |
Create a CDM7160 instance which is connected to specified I2C pins with specified address. | |
~CDM7160 () | |
Destructor of CDM7160. | |
int8_t | init () |
Initialize the CDM7160 Calling function control() and set sensor in continuous mode. | |
int8_t | initIntegrated (uint16_t hpa=1005, uint16_t height=130, eControlMode mode=CONTIN, eFunctionSetting atm_alt_correct=HPAE_ON, eFunctionSetting pwm_conce=PWMR_LOW, eFunctionSetting pwm_pin=PWME_OFF) |
Integrated Initialize the CDM7160 sensor By default: set Atmospheric pressure and altitude, set sensor in countinous mode, enable atm. | |
int | getCO2 () |
Measure CO2 in ppm Measurement is stored in struct variable: int co2. | |
int8_t | control (eControlMode mode=CONTIN) |
Periodic Measurement mode of the CDM7160 CDM7160 goes into idle state. | |
int8_t | softReset () |
Soft reset command soft reset for CDM7160 sensor. | |
int8_t | getStatus () |
Read Status Register status information of busy, alarm, connection on CAD0 and MSEL Data stored in variable: uint8_t status. | |
int8_t | setAlarmLimits (uint16_t high_limit=1000, uint16_t low_limit=400) |
Set Alert High and Low Limit. | |
int8_t | getAlarmLimits () |
Read Alert High and Low Limit Data stored in variable: uint16_t highAlertLimit, uint16_t lowAlertLimit. | |
int8_t | setAirPressureAndAltitude (uint16_t hpa=1005, uint16_t height=130) |
Set Atmospheric Pressure and Altitude - to correct calculation CO2. | |
int8_t | getAirPressureAndAltitude () |
Read Atmospheric Pressure and Altitude - correction value calculation CO2 Data stored in variable: uint16_t atmosferic_pressure, uint16_t altitude. | |
int8_t | getSettings () |
Read Setting Register settings information of PWM pin enable/disable, concentration range and atmospheric pressure and altitude correction enable/disable Data stored in variable: uint8_t settings. | |
int8_t | setSettings (eFunctionSetting atm_alt_correct=HPAE_OFF, eFunctionSetting pwm_conce=PWMR_LOW, eFunctionSetting pwm_pin=PWME_OFF) |
Set Atmospheric Pressure and Altitude - to correct calculation CO2. | |
int8_t | selfDiagnosis () |
Self-test - diagnosis errors Data stored in variable: uint8_t selfDiag. |
Detailed Description
Implementation of CDM7160 sensor CO2 library.
Definition at line 124 of file CDM7160.h.
Member Enumeration Documentation
enum eControlMode |
enum eFunctionSetting |
Constructor & Destructor Documentation
CDM7160 | ( | PinName | sda, |
PinName | scl, | ||
uint8_t | addr = CDM7160_I2C_ADDR |
||
) |
Create an CDM7160 instance which is connected to specified I2C pins with specified address.
Project: CDM7160 Company: yosensi.io CodeWriter: Michal Kozlowski File: CDM7160.cpp Date: 09-09-2019 Description: CDM7160 Driver Operation File.
- Parameters:
-
sda I2C-bus SDA pin scl I2C-bus SCL pin addr (option) I2C-bus address (default: 0x4A)
Definition at line 14 of file CDM7160.cpp.
CDM7160 | ( | I2C & | i2c_obj, |
uint8_t | addr = CDM7160_I2C_ADDR |
||
) |
Create a CDM7160 instance which is connected to specified I2C pins with specified address.
- Parameters:
-
i2c_obj I2C object (instance) addr (option) I2C-bus address (default: 0x4A) Constructor of CDM7160
Definition at line 21 of file CDM7160.cpp.
~CDM7160 | ( | ) |
Destructor of CDM7160.
Definition at line 28 of file CDM7160.cpp.
Member Function Documentation
int8_t control | ( | eControlMode | mode = CONTIN ) |
Periodic Measurement mode of the CDM7160 CDM7160 goes into idle state.
- Parameters:
-
mode - operation mode (Power down or continuous)
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 76 of file CDM7160.cpp.
int8_t getAirPressureAndAltitude | ( | ) |
Read Atmospheric Pressure and Altitude - correction value calculation CO2 Data stored in variable: uint16_t atmosferic_pressure, uint16_t altitude.
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 141 of file CDM7160.cpp.
int8_t getAlarmLimits | ( | ) |
Read Alert High and Low Limit Data stored in variable: uint16_t highAlertLimit, uint16_t lowAlertLimit.
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 116 of file CDM7160.cpp.
int getCO2 | ( | ) |
Measure CO2 in ppm Measurement is stored in struct variable: int co2.
- Returns:
- co2 if sucessful. CDM7160_ERROR if fail
Definition at line 89 of file CDM7160.cpp.
int8_t getSettings | ( | ) |
Read Setting Register settings information of PWM pin enable/disable, concentration range and atmospheric pressure and altitude correction enable/disable Data stored in variable: uint8_t settings.
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 171 of file CDM7160.cpp.
int8_t getStatus | ( | ) |
Read Status Register status information of busy, alarm, connection on CAD0 and MSEL Data stored in variable: uint8_t status.
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 103 of file CDM7160.cpp.
int8_t init | ( | ) |
Initialize the CDM7160 Calling function control() and set sensor in continuous mode.
==================== PUBLIC FUNCTIONS ====================
- Returns:
- CDM7160 address if successful. CDM7160_ERROR if fail
Definition at line 37 of file CDM7160.cpp.
int8_t initIntegrated | ( | uint16_t | hpa = 1005 , |
uint16_t | height = 130 , |
||
eControlMode | mode = CONTIN , |
||
eFunctionSetting | atm_alt_correct = HPAE_ON , |
||
eFunctionSetting | pwm_conce = PWMR_LOW , |
||
eFunctionSetting | pwm_pin = PWME_OFF |
||
) |
Integrated Initialize the CDM7160 sensor By default: set Atmospheric pressure and altitude, set sensor in countinous mode, enable atm.
pressure and altitude correction in measurement and disable PWM output PIN
- Returns:
- CDM7160 address if successful. CDM7160_ERROR if fail
Definition at line 47 of file CDM7160.cpp.
int8_t selfDiagnosis | ( | ) |
Self-test - diagnosis errors Data stored in variable: uint8_t selfDiag.
- Returns:
- CDM7160 address if successful. CDM7160_ERROR if fail
Definition at line 195 of file CDM7160.cpp.
int8_t setAirPressureAndAltitude | ( | uint16_t | hpa = 1005 , |
uint16_t | height = 130 |
||
) |
Set Atmospheric Pressure and Altitude - to correct calculation CO2.
- Parameters:
-
hpa - atmospheric pressure value in [hPa] height - altitude value in [m]
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 157 of file CDM7160.cpp.
int8_t setAlarmLimits | ( | uint16_t | high_limit = 1000 , |
uint16_t | low_limit = 400 |
||
) |
Set Alert High and Low Limit.
- Parameters:
-
high_limit - high limit value low_limit - low limit value
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 128 of file CDM7160.cpp.
int8_t setSettings | ( | eFunctionSetting | atm_alt_correct = HPAE_OFF , |
eFunctionSetting | pwm_conce = PWMR_LOW , |
||
eFunctionSetting | pwm_pin = PWME_OFF |
||
) |
Set Atmospheric Pressure and Altitude - to correct calculation CO2.
- Parameters:
-
atm_alt_correct - atm. pressure and altitude correction Enable/Disable pwm_conce - PWM output contrntration High/Low pwm_pin - PWM pin enable/disable
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 182 of file CDM7160.cpp.
int8_t softReset | ( | ) |
Soft reset command soft reset for CDM7160 sensor.
- Returns:
- CDM7160_SUCCESS if successful. CDM7160_ERROR if fail
Definition at line 67 of file CDM7160.cpp.
Generated on Fri Jul 15 2022 13:16:54 by
