|
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_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...
|
|
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_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_RelIaqDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_rel_iaq_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::relIaqDataCalculate. More...
|
|
fsp_err_t | RM_ZMOD4XXX_PbaqDataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_pbaq_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::pbaqDataCalculate. More...
|
|
fsp_err_t | RM_ZMOD4XXX_No2O3DataCalculate (rm_zmod4xxx_ctrl_t *const p_api_ctrl, rm_zmod4xxx_raw_data_t *const p_raw_data, rm_zmod4xxx_no2_o3_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::no2O3DataCalculate. 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...
|
|
Middleware to implement the ZMOD4XXX sensor interface. This module implements the ZMOD4XXX Middleware Interface.
Overview
The following measurement modes are EOL.
- ZMOD4410 Odor
- ZMOD4510 OAQ 1st Generation
This module provides an API for configuring and controlling the ZMOD4XXX sensor. Supported ZMOD4XXX sensors are below.
- ZMOD4410
- ZMOD4450
- ZMOD4510
I2C communication with the ZMOD4XXX sensor is realized by connecting with the rm_comms_i2c module.
Features
The ZMOD4XXX sensor interface implementation has the following key features:
- Initialize the sensor for measurement
- Start a measurement at any time
- Read status register for wait until the measurement is done. This will also be signaled by an interrupt
- Get the ADC data from the sensor
- Input the ADC data and acquire the air quality values by calculation in the library.
Configuration
Build Time Configurations for rm_zmod4xxx
The following build time configurations are defined in fsp_cfg/rm_zmod4xxx_cfg.h:
Configuration | Options | Default | Description |
Parameter Checking |
-
Default (BSP)
-
Enabled
-
Disabled
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configurations for Sensor > ZMOD4XXX Gas Sensor (rm_zmod4xxx)
This module can be added to the Stacks tab via New Stack > Sensor > ZMOD4XXX Gas Sensor (rm_zmod4xxx).
Configuration | Options | Default | Description |
Name | Name must be a valid C symbol | 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. |
Pin Configuration
This module use SDA and SCL pins of I2C Master and SCI I2C.
Usage Notes
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 |
Relative IAQ | Lightweight algorithm reacts to air quality changes and outputs a relative IAQ |
Relative IAQ Ultra Low Power | Lightweight algorithm reacts to air quality changes and outputs a relative IAQ. This method offers a much lower power consumption |
Public Building AQ Standard (PBAQ) | For highly accurate and consistent sensor readings to fulfill public building standards. |
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 |
ZMOD4450 datasheet is here.
The ZMOD4450 has one modes of operation.
The response time for a gas stimulation is always within a few seconds, depending on the gas and its concentration. An active or direct airflow onto the sensor module is not necessary since diffusion of ambient gas does not limit the sensor module response time. The ZMOD4450 will respond to typical refrigeration gases immediate upon start-up; however, a conditioning period of 48 hours in a refrigeration environment is recommended to improve stability and get maximum performance, as the module algorithm is able to learn about the refrigeration environment over time.
Method | Description |
RAQ | Control signal based on Refrigerator Air Quality Changes |
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.
For NO2 O3 operation a response to nitrogen_dioxide and ozone will be seen after a warmup time of 5 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 |
NO2 O3 | Selective nitrogen dioxide and ozone firmware |
A library corresponding to each of these modes is required. By setting in RA Configuration, the library will be generated in the ra/fsp/lib/rm_zmod4xxx folder of your project.
If an RTOS is used, blocking and bus lock is available.
- If blocking of an I2C bus is required, it is necessary to create a semaphore for blocking.
- If bus lock is required, it is necessary to create a mutex for bus lock. Bus lock is only available when a semaphore for blocking is used.
Notifications
The ZMOD4xxx sensor needs a reset before operation; please input a reset signal to the RES_N pin (active low).
Program flow for OAQ 2nd gen is changed in FSP v4.0.0. Please refer to the programming manual [R36US0004EU] and the application note[R01AN5899].
R01AN5899 : https://www.renesas.com/document/apn/zmod4xxx-sample-application
R36US0004EU : https://www.renesas.com/document/mat/zmod4510-programming-manual-read-me
Bus Initialization
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.
Initialization
Initialize with RM_ZMOD4XXX_Open(). One channel of timer is required to measure the waiting time at initialization.
From measurement start to data acquisition
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.
If IRQ is enabled
- Call RM_ZMOD4XXX_MeasurementStart().
- Wait until RM_ZMOD4XXX_EVENT_MEASUREMENT_COMPLETE is received via IRQ callback.
- Call RM_ZMOD4XXX_Read(). This function will read the ADC data.
- Wait until RM_ZMOD4XXX_EVENT_SUCCESS is received.
- Call the DataCalculate API according to the mode.
If IRQ is disabled
- Call RM_ZMOD4XXX_MeasurementStart().
- Wait until RM_ZMOD4XXX_EVENT_SUCCESS is received.
- Call RM_ZMOD4XXX_StatusCheck(). This function will execute a status check over I2C.
- If RM_ZMOD4XXX_EVENT_MEASUREMENT_NOT_COMPLETE is received in callback, user should wait some time and then call RM_ZMOD4XXX_StatusCheck() again.
- Wait until RM_ZMOD4XXX_EVENT_MEASUREMENT_COMPLETE is received.
- Call RM_ZMOD4XXX_Read() and read the ADC data.
- Wait until RM_ZMOD4XXX_EVENT_SUCCESS is received.
- Call the DataCalculate API according to the mode.
Checking device error for IAQ 2nd Gen.
- Call RM_ZMOD4XXX_DeviceErrorCheck(). This function will execute a device error check over I2C.
- If any device error occurs, RM_ZMOD4XXX_EVENT_DEV_ERR_POWER_ON_RESET or RM_ZMOD4XXX_EVENT_DEV_ERR_ACCESS_CONFLICT are received in callback. If no device error, RM_ZMOD4XXX_EVENT_SUCCESS is received in callback.
Examples
Basic Example
These are basic examples of minimal use of ZMOD4XXX sensor implementation in an application.
IAQ 1st Gen. Continuous mode
void rm_zmod4xxx_iaq_1st_gen_continuous_basic_example (void)
{
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
while (1)
{
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
if (FSP_SUCCESS == err)
{
}
{
}
else
{
handle_error(err);
}
}
}
IAQ 1st Gen. Low Power mode
void rm_zmod4xxx_iaq_1st_gen_low_power_basic_example (void)
{
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
if (FSP_SUCCESS == err)
{
}
{
}
else
{
handle_error(err);
}
}
}
IAQ 2nd Gen.
void rm_zmod4xxx_iaq_2nd_gen_basic_example (void)
{
float temperature = ZMOD4XXX_DEFAULT_TEMPERATURE_20F;
float humidity = ZMOD4XXX_DEFAULT_HUMIDITY_50F;
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
handle_error(err);
if (FSP_SUCCESS == err)
{
}
{
}
{
}
else
{
handle_error(err);
}
}
}
IAQ 2nd Gen. ULP
void rm_zmod4xxx_iaq_2nd_gen_ulp_basic_example (void)
{
float temperature = ZMOD4XXX_DEFAULT_TEMPERATURE_20F;
float humidity = ZMOD4XXX_DEFAULT_HUMIDITY_50F;
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
handle_error(err);
if (FSP_SUCCESS == err)
{
}
{
}
{
}
else
{
handle_error(err);
}
}
}
Relative IAQ
void rm_zmod4xxx_rel_iaq_basic_example (void)
{
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
if (FSP_SUCCESS == err)
{
}
{
}
{
}
else
{
handle_error(err);
}
}
}
Relative IAQ ULP
void rm_zmod4xxx_rel_iaq_ulp_basic_example (void)
{
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
if (FSP_SUCCESS == err)
{
}
{
}
{
}
else
{
handle_error(err);
}
}
}
PBAQ
void rm_zmod4xxx_pbaq_basic_example (void)
{
float temperature = ZMOD4XXX_DEFAULT_TEMPERATURE_20F;
float humidity = ZMOD4XXX_DEFAULT_HUMIDITY_50F;
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
handle_error(err);
if (FSP_SUCCESS == err)
{
}
{
}
{
}
else
{
handle_error(err);
}
}
}
Odor
void rm_zmod4xxx_odor_basic_example (void)
{
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
while (1)
{
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
if (FSP_SUCCESS == err)
{
}
{
}
else
{
handle_error(err);
}
}
}
Sulfur Odor
void rm_zmod4xxx_sulfur_odor_basic_example (void)
{
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
if (FSP_SUCCESS == err)
{
}
{
}
else
{
handle_error(err);
}
}
}
OAQ 1st Gen.
void rm_zmod4xxx_oaq_1st_gen_basic_example (void)
{
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
if (FSP_SUCCESS == err)
{
}
{
}
else
{
handle_error(err);
}
}
}
OAQ 2nd Gen.
void rm_zmod4xxx_oaq_2nd_gen_basic_example (void)
{
float temperature = ZMOD4XXX_DEFAULT_TEMPERATURE_20F;
float humidity = ZMOD4XXX_DEFAULT_HUMIDITY_50F;
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
handle_error(err);
if (FSP_SUCCESS == err)
{
}
{
}
{
}
else
{
handle_error(err);
}
}
}
NO2 O3
void rm_zmod4xxx_no2_o3_basic_example (void)
{
float temperature = ZMOD4XXX_DEFAULT_TEMPERATURE_20F;
float humidity = ZMOD4XXX_DEFAULT_HUMIDITY_50F;
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
while (1)
{
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
{
while (1)
{
;
}
}
handle_error(err);
if (FSP_SUCCESS == err)
{
}
{
}
{
}
else
{
handle_error(err);
}
}
}
RAQ
void rm_zmod4xxx_raq_basic_example (void)
{
rm_comms_i2c_bus_extended_cfg_t * p_extend =
(rm_comms_i2c_bus_extended_cfg_t *) g_zmod4xxx_cfg.p_comms_instance->p_cfg->p_extend;
p_driver_instance->
p_api->
open(p_driver_instance->p_ctrl, p_driver_instance->p_cfg);
#if BSP_CFG_RTOS
if (NULL != p_extend->p_blocking_semaphore)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_semaphore_create(p_extend->p_blocking_semaphore->p_semaphore_handle,
p_extend->p_blocking_semaphore->p_semaphore_name,
(ULONG) 0);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_blocking_semaphore->p_semaphore_handle) =
xSemaphoreCreateCountingStatic((UBaseType_t) 1,
(UBaseType_t) 0,
p_extend->p_blocking_semaphore->p_semaphore_memory);
#endif
}
if (NULL != p_extend->p_bus_recursive_mutex)
{
#if BSP_CFG_RTOS == 1 // AzureOS
tx_mutex_create(p_extend->p_bus_recursive_mutex->p_mutex_handle,
p_extend->p_bus_recursive_mutex->p_mutex_name,
TX_INHERIT);
#elif BSP_CFG_RTOS == 2 // FreeRTOS
*(p_extend->p_bus_recursive_mutex->p_mutex_handle) =
xSemaphoreCreateRecursiveMutexStatic(p_extend->p_bus_recursive_mutex->p_mutex_memory);
#endif
}
#endif
handle_error(err);
#if ZMOD4XXX_IRQ_ENABLE
g_zmod4xxx_irq_callback_flag = 0;
#endif
g_zmod4xxx_i2c_callback_flag = 0;
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
while (1)
{
do
{
#if ZMOD4XXX_IRQ_ENABLE
while (0U == g_zmod4xxx_irq_callback_flag)
{
}
g_zmod4xxx_irq_callback_flag = 0;
#else
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
#endif
{
}
handle_error(err);
while (0U == g_zmod4xxx_i2c_callback_flag)
{
}
g_zmod4xxx_i2c_callback_flag = 0;
if (FSP_SUCCESS == err)
{
}
{
}
else
{
handle_error(err);
}
}
}
◆ rm_zmod4xxx_init_process_params_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. |
◆ rm_zmod4xxx_instance_ctrl_t
struct rm_zmod4xxx_instance_ctrl_t |
◆ rm_zmod4xxx_lib_type_t
◆ RM_ZMOD4XXX_Open()
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.
- Return values
-
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. |
◆ RM_ZMOD4XXX_Close()
This function should be called when close the sensor. Implements rm_zmod4xxx_api_t::close.
- Return values
-
FSP_SUCCESS | Successfully closed. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_ZMOD4XXX_MeasurementStart()
This function should be called when start a measurement. Implements rm_zmod4xxx_api_t::measurementStart.
- Return values
-
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. |
◆ RM_ZMOD4XXX_MeasurementStop()
This function should be called when stop a measurement. Implements rm_zmod4xxx_api_t::measurementStop.
- Return values
-
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. |
◆ RM_ZMOD4XXX_StatusCheck()
This function should be called when polling is used. It reads the status of sensor. Implements rm_zmod4xxx_api_t::statusCheck.
- Return values
-
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. |
◆ RM_ZMOD4XXX_Read()
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.
- Return values
-
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. |
◆ RM_ZMOD4XXX_Iaq1stGenDataCalculate()
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.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_Iaq2ndGenDataCalculate()
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.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_OdorDataCalculate()
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.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_SulfurOdorDataCalculate()
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.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_Oaq1stGenDataCalculate()
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.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_Oaq2ndGenDataCalculate()
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.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_RaqDataCalculate()
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.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_RelIaqDataCalculate()
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::relIaqDataCalculate.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_PbaqDataCalculate()
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::pbaqDataCalculate.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_No2O3DataCalculate()
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::no2O3DataCalculate.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter or library internal error occured. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
FSP_ERR_SENSOR_IN_STABILIZATION | Module is stabilizing. |
FSP_ERR_SENSOR_INVALID_DATA | Sensor probably damaged. Algorithm results may be incorrect. |
◆ RM_ZMOD4XXX_TemperatureAndHumiditySet()
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.
- Return values
-
FSP_SUCCESS | Successfully results are read. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not opened configured. |
◆ RM_ZMOD4XXX_DeviceErrorCheck()
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.
- Return values
-
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. |