RZG Flexible Software Package Documentation
Release v2.1.0
|
|
Functions | |
fsp_err_t | RM_ZMOD4XXX_Open (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_cfg_t const *const p_cfg) |
This function should be called when start a measurement and when measurement data is stale data. Sends the slave address to the zmod4xxx and start a measurement. Implements rm_zmod4xxx_api_t::open. More... | |
fsp_err_t | RM_ZMOD4XXX_MeasurementStart (rm_zmod4xxx_ctrl_t *const p_api_ctrl) |
This function should be called when start a measurement. Implements rm_zmod4xxx_api_t::measurementStart. More... | |
fsp_err_t | RM_ZMOD4XXX_MeasurementStop (rm_zmod4xxx_ctrl_t *const p_api_ctrl) |
This function should be called when stop a measurement. Implements rm_zmod4xxx_api_t::measurementStop. More... | |
fsp_err_t | RM_ZMOD4XXX_StatusCheck (rm_zmod4xxx_ctrl_t *const p_api_ctrl) |
This function should be called when polling is used. It reads the status of sensor. Implements rm_zmod4xxx_api_t::statusCheck. More... | |
fsp_err_t | RM_ZMOD4XXX_Read (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::read. More... | |
fsp_err_t | RM_ZMOD4XXX_TemperatureAndHumiditySet (rm_zmod4xxx_ctrl_t *const p_api_ctrl, float temperature, float humidity) |
This function is valid only for OAQ_2nd_Gen and IAQ_2nd_Gen_ULP. This function should be called before DataCalculate. Humidity and temperature measurements are needed for ambient compensation. Implements rm_zmod4xxx_api_t::temperatureAndHumiditySet. More... | |
fsp_err_t | RM_ZMOD4XXX_DeviceErrorCheck (rm_zmod4xxx_ctrl_t *const p_api_ctrl) |
This function is valid only for IAQ_2nd_Gen and IAQ_2nd_Gen_ULP. This function should be called before Read and DataCalculate. Check for unexpected reset occurs or getting unvalid ADC data. Implements rm_zmod4xxx_api_t::deviceErrorCheck. More... | |
fsp_err_t | RM_ZMOD4XXX_Iaq1stGenDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_iaq_1st_data_t *const p_zmod4xxx_data) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::iaq1stGenDataCalculate. More... | |
fsp_err_t | RM_ZMOD4XXX_Iaq2ndGenDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_iaq_2nd_data_t *const p_zmod4xxx_data) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::iaq2ndGenDataCalculate. More... | |
fsp_err_t | RM_ZMOD4XXX_OdorDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_odor_data_t *const p_zmod4xxx_data) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::odorDataCalculate. More... | |
fsp_err_t | RM_ZMOD4XXX_SulfurOdorDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_sulfur_odor_data_t *const p_zmod4xxx_data) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::sulfurOdorDataCalculate. More... | |
fsp_err_t | RM_ZMOD4XXX_Oaq1stGenDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_oaq_1st_data_t *const p_zmod4xxx_data) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::oaq1stGenDataCalculate. More... | |
fsp_err_t | RM_ZMOD4XXX_Oaq2ndGenDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_oaq_2nd_data_t *const p_zmod4xxx_data) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::oaq2ndGenDataCalculate. More... | |
fsp_err_t | RM_ZMOD4XXX_RaqDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_raq_data_t *const p_zmod4xxx_data) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::raqDataCalculate. More... | |
fsp_err_t | RM_ZMOD4XXX_Close (rm_zmod4xxx_ctrl_t *const p_api_ctrl) |
This function should be called when close the sensor. Implements rm_zmod4xxx_api_t::close. More... | |
Middleware to implement the ZMOD4XXX sensor interface. This module implements the ZMOD4XXX Middleware Interface.
This module provides an API for configuring and controlling the ZMOD4XXX sensor. Supported ZMOD4XXX sensors are below.
I2C communication with the ZMOD4XXX sensor is realized by connecting with the rm_comms_i2c module.
The ZMOD4xxx sensor needs a reset before operation; please input a reset signal to the RES_N pin (active low).
Library files may not be automatically registered to Linker. If so, please register library files manually.
e.g.)
If lib_iaq_2nd_gen.a file is to be registered, please register _iaq_2nd_gen to "User defined archive (library) file (-l)"
"User defined archive (library) file (-l)" is an item in Properties->C/C++ Build->Settings->Cross ARM C Linker-> Libraries.
The ZMOD4XXX sensor interface implementation has the following key features:
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Manual Entry | g_zmod4xxx_sensor0 | Module name. |
Comms I2C Callback | Name must be a valid C symbol | zmod4xxx_comms_i2c_callback | A user COMMS I2C callback function can be provided. |
IRQ Callback | Name must be a valid C symbol | zmod4xxx_irq_callback | A user IRQ callback function can be provided. |
This module uses SDA and SCL pins of I2C Master.
ZMOD4410 datasheet is here.
The ZMOD4410 has five modes of operation.
The ZMOD4410 will respond to TVOC immediately upon start-up; however, a conditioning period of 48 hours followed by a sensor module restart in an ambient environment is recommended to improve stability and obtain maximum performance.
Best results are achieved with continuous operation because the module algorithm can learn about the environment over time.
Method | Description |
---|---|
IAQ 1st Generation Continuous | Measurement of UBA levels for IAQ and eCO2, provides continuous data |
IAQ 1st Generation Low Power | Measurement of UBA levels for IAQ and eCO2, fixed sampling interval of 6 seconds |
IAQ 2nd Generation | Using AI for improved ppm TVOC, IAQ and eCO2 functionality (recommended for new designs) |
IAQ 2nd Generation Ultra Low Power | Using AI for improved ppm TVOC, IAQ and eCO2 functionality. This method offers a much lower power consumption |
Odor | Control signal based on Air Quality Changes |
Sulfur-based Odor Discrimination | The odors in “sulfur” (sulfur based) and “acceptable” (organic based) and shows an intensity level of the smell |
ZMOD4510 datasheet is here.
The ZMOD4510 has two modes of operation.
The ZMOD4510 in OAQ 1st Gen operation will respond to typical outdoor gases after a warm-up time of 60 min, consisting of 20 min for stabilization and 40 min for baseline finding.
For OAQ 2nd Gen operation a response to ozone will be seen after a warmup time of 30 min.
In all operation modes a conditioning period of 48 hours followed by a sensor module restart in an ambient environment is recommended to improve stability and obtain maximum performance.
Method | Description |
---|---|
OAQ 1st Generation | Measurement of Air Quality |
OAQ 2nd Generation | Selective Ozone featuring Ultra-Low Power |
A library corresponding to each of these modes is required. By setting in Configuration, the library will be generated in the rzg/fsp/lib/rm_zmod4xxx folder of your project.
If an RTOS is used, blocking and bus lock is available.
The ZMOD4XXX interface expects a bus instance to be opened before opening any ZMOD4XXX device. The interface will handle switching between devices on the bus but will not open or close the bus instance. The user should open the bus with the appropriate I2C Master Interface open call.
Initialize with RM_ZMOD4XXX_Open(). One channel of timer is required to measure the waiting time at initialization.
After normal completion, start the measurement with RM_ZMOD4XXX_MeasurementStart(). An endless loop continuously checks the status of the ZMOD4XXX sensor and reads its data. The raw data is subsequently processed, and the air quality values are calculated.
These are basic examples of minimal use of ZMOD4XXX sensor implementation in an application.
IAQ 1st Gen. Continuous mode
IAQ 1st Gen. Low Power mode
IAQ 2nd Gen.
IAQ 2nd Gen. ULP
Odor
Sulfur Odor
OAQ 1st Gen.
OAQ 2nd Gen.
Data Structures | |
struct | rm_zmod4xxx_init_process_params_t |
struct | rm_zmod4xxx_instance_ctrl_t |
Enumerations | |
enum | rm_zmod4xxx_lib_type_t |
struct rm_zmod4xxx_init_process_params_t |
ZMOD4XXX initialization process block
Data Fields | ||
---|---|---|
volatile uint32_t | delay_ms | Delay milliseconds. |
volatile bool | communication_finished | Communication flag for blocking. |
volatile bool | measurement_finished | IRQ flag. |
volatile rm_zmod4xxx_event_t | event | Callback event. |
struct rm_zmod4xxx_instance_ctrl_t |
ZMOD4XXX control block
Data Fields | |
uint32_t | open |
Open flag. | |
uint8_t | buf [RM_ZMOD4XXX_MAX_I2C_BUF_SIZE] |
Buffer for I2C communications. | |
uint8_t | register_address |
Register address to access. | |
rm_zmod4xxx_status_params_t | status |
Status parameter. | |
volatile bool | dev_err_check |
Flag for checking device error. | |
volatile rm_zmod4xxx_event_t | event |
Callback event. | |
rm_zmod4xxx_init_process_params_t | init_process_params |
For the initialization process. | |
rm_zmod4xxx_cfg_t const * | p_cfg |
Pointer of configuration block. | |
rm_comms_instance_t const * | p_comms_i2c_instance |
Pointer of I2C Communications Middleware instance structure. | |
rm_zmod4xxx_lib_extended_cfg_t * | p_zmod4xxx_lib |
Pointer of ZMOD4XXX Lib extended configuration. | |
void const * | p_irq_instance |
Pointer to IRQ instance. | |
void const * | p_context |
Pointer to the user-provided context. | |
void(* | p_comms_callback )(rm_zmod4xxx_callback_args_t *p_args) |
I2C Communications callback. | |
void(* | p_irq_callback )(rm_zmod4xxx_callback_args_t *p_args) |
IRQ callback. | |
ZMOD4XXX Library type
fsp_err_t RM_ZMOD4XXX_Open | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_cfg_t const *const | p_cfg | ||
) |
This function should be called when start a measurement and when measurement data is stale data. Sends the slave address to the zmod4xxx and start a measurement. Implements rm_zmod4xxx_api_t::open.
FSP_SUCCESS | Successfully started. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_ALREADY_OPEN | Module is already open. |
FSP_ERR_UNSUPPORTED | Unsupport product ID. |
FSP_ERR_TIMEOUT | communication is timeout. |
FSP_ERR_ABORTED | communication is aborted. |
fsp_err_t RM_ZMOD4XXX_MeasurementStart | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl | ) |
This function should be called when start a measurement. Implements rm_zmod4xxx_api_t::measurementStart.
FSP_SUCCESS | Successfully started. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
FSP_ERR_TIMEOUT | communication is timeout. |
FSP_ERR_ABORTED | communication is aborted. |
fsp_err_t RM_ZMOD4XXX_MeasurementStop | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl | ) |
This function should be called when stop a measurement. Implements rm_zmod4xxx_api_t::measurementStop.
FSP_SUCCESS | Successfully started. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
FSP_ERR_TIMEOUT | communication is timeout. |
FSP_ERR_ABORTED | communication is aborted. |
fsp_err_t RM_ZMOD4XXX_StatusCheck | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl | ) |
This function should be called when polling is used. It reads the status of sensor. Implements rm_zmod4xxx_api_t::statusCheck.
FSP_SUCCESS | Successfully started. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
FSP_ERR_TIMEOUT | communication is timeout. |
FSP_ERR_ABORTED | communication is aborted. |
fsp_err_t RM_ZMOD4XXX_Read | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_raw_data_t *const | p_raw_data | ||
) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::read.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
FSP_ERR_TIMEOUT | Communication is timeout. |
FSP_ERR_ABORTED | Communication is aborted. |
FSP_ERR_SENSOR_MEASUREMENT_NOT_FINISHED | Measurement is not finished. |
fsp_err_t RM_ZMOD4XXX_TemperatureAndHumiditySet | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
float | temperature, | ||
float | humidity | ||
) |
This function is valid only for OAQ_2nd_Gen and IAQ_2nd_Gen_ULP. This function should be called before DataCalculate. Humidity and temperature measurements are needed for ambient compensation. Implements rm_zmod4xxx_api_t::temperatureAndHumiditySet.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
fsp_err_t RM_ZMOD4XXX_DeviceErrorCheck | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl | ) |
This function is valid only for IAQ_2nd_Gen and IAQ_2nd_Gen_ULP. This function should be called before Read and DataCalculate. Check for unexpected reset occurs or getting unvalid ADC data. Implements rm_zmod4xxx_api_t::deviceErrorCheck.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
FSP_ERR_TIMEOUT | communication is timeout. |
FSP_ERR_ABORTED | communication is aborted. |
fsp_err_t RM_ZMOD4XXX_Iaq1stGenDataCalculate | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_raw_data_t *const | p_raw_data, | ||
rm_zmod4xxx_iaq_1st_data_t *const | p_zmod4xxx_data | ||
) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::iaq1stGenDataCalculate.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
fsp_err_t RM_ZMOD4XXX_Iaq2ndGenDataCalculate | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_raw_data_t *const | p_raw_data, | ||
rm_zmod4xxx_iaq_2nd_data_t *const | p_zmod4xxx_data | ||
) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::iaq2ndGenDataCalculate.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
fsp_err_t RM_ZMOD4XXX_OdorDataCalculate | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_raw_data_t *const | p_raw_data, | ||
rm_zmod4xxx_odor_data_t *const | p_zmod4xxx_data | ||
) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::odorDataCalculate.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
fsp_err_t RM_ZMOD4XXX_SulfurOdorDataCalculate | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_raw_data_t *const | p_raw_data, | ||
rm_zmod4xxx_sulfur_odor_data_t *const | p_zmod4xxx_data | ||
) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::sulfurOdorDataCalculate.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
fsp_err_t RM_ZMOD4XXX_Oaq1stGenDataCalculate | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_raw_data_t *const | p_raw_data, | ||
rm_zmod4xxx_oaq_1st_data_t *const | p_zmod4xxx_data | ||
) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::oaq1stGenDataCalculate.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
fsp_err_t RM_ZMOD4XXX_Oaq2ndGenDataCalculate | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_raw_data_t *const | p_raw_data, | ||
rm_zmod4xxx_oaq_2nd_data_t *const | p_zmod4xxx_data | ||
) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::oaq2ndGenDataCalculate.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
fsp_err_t RM_ZMOD4XXX_RaqDataCalculate | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl, |
rm_zmod4xxx_raw_data_t *const | p_raw_data, | ||
rm_zmod4xxx_raq_data_t *const | p_zmod4xxx_data | ||
) |
This function should be called when measurement finishes. To check measurement status either polling or busy/interrupt pin can be used. Implements rm_zmod4xxx_api_t::raqDataCalculate.
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
fsp_err_t RM_ZMOD4XXX_Close | ( | rm_zmod4xxx_ctrl_t *const | p_api_ctrl | ) |
This function should be called when close the sensor. Implements rm_zmod4xxx_api_t::close.
FSP_SUCCESS | Successfully closed. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not open. |