ZMOD4510 Nitrogen Dioxide and Ozone Firmware Documentation |

zmod4xxx.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * Copyright (c) 2024 Renesas Electronics Corporation
3 * All Rights Reserved.
4 *
5 * This code is proprietary to Renesas, and is license pursuant to the terms and
6 * conditions that may be accessed at:
7 * https://www.renesas.com/eu/en/document/msc/renesas-software-license-terms-gas-sensor-software
8 *****************************************************************************/
9
19 #ifndef _ZMOD4XXX_H
20 #define _ZMOD4XXX_H
21
22 #include "zmod4xxx_types.h"
23
24 #define ZMOD4XXX_ADDR_PID (0x00)
25 #define ZMOD4XXX_ADDR_CONF (0x20)
26 #define ZMOD4XXX_ADDR_PROD_DATA (0x26)
27 #define ZMOD4XXX_ADDR_CMD (0x93)
28 #define ZMOD4XXX_ADDR_STATUS (0x94)
29 #define ZMOD4XXX_ADDR_TRACKING (0x3A)
30
31 #define ZMOD4XXX_LEN_PID (2)
32 #define ZMOD4XXX_LEN_CONF (6)
33 #define ZMOD4XXX_LEN_TRACKING (6)
34
35 #define HSP_MAX (8)
36 #define RSLT_MAX (32)
37
38 #define STATUS_SEQUENCER_RUNNING_MASK (0x80)
39 #define STATUS_SLEEP_TIMER_ENABLED_MASK (0x40)
40 #define STATUS_ALARM_MASK (0x20)
41 #define STATUS_LAST_SEQ_STEP_MASK (0x1F)
42 #define STATUS_POR_EVENT_MASK (0x80)
43 #define STATUS_ACCESS_CONFLICT_MASK (0x40)
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49
58 zmod4xxx_err zmod4xxx_calc_factor(zmod4xxx_conf *conf, uint8_t *hsp,
59 uint8_t *config);
60
69 float zmod4xxx_calc_single_rmox(zmod4xxx_dev_t *dev, uint8_t *adc_result);
70
83 zmod4xxx_err zmod4xxx_calc_rmox(zmod4xxx_dev_t *dev, uint8_t *adc_result,
84 float *rmox);
85
93 zmod4xxx_err zmod4xxx_check_error_event(zmod4xxx_dev_t *dev);
94
104 zmod4xxx_err zmod4xxx_init_measurement(zmod4xxx_dev_t *dev);
105
115 zmod4xxx_err zmod4xxx_init_sensor(zmod4xxx_dev_t *dev);
116
124 zmod4xxx_err zmod4xxx_null_ptr_check(zmod4xxx_dev_t *dev);
125
133 zmod4xxx_err zmod4xxx_prepare_sensor(zmod4xxx_dev_t *dev);
134
143 zmod4xxx_err zmod4xxx_read_adc_result(zmod4xxx_dev_t *dev, uint8_t *adc_result);
144
156 zmod4xxx_err zmod4xxx_read_rmox(zmod4xxx_dev_t *dev, uint8_t *adc_result,
157 float *rmox);
158
168 zmod4xxx_err zmod4xxx_read_sensor_info(zmod4xxx_dev_t *dev);
169
178 zmod4xxx_err zmod4xxx_read_status(zmod4xxx_dev_t *dev, uint8_t *status);
179
190 zmod4xxx_err zmod4xxx_read_tracking_number(zmod4xxx_dev_t *dev,
191 uint8_t *track_num);
192
200 zmod4xxx_err zmod4xxx_start_measurement(zmod4xxx_dev_t *dev);
201
210 zmod4xxx_err zmod4xxx_start_measurement_at(zmod4xxx_dev_t *dev, uint8_t step );
211
212 #ifdef __cplusplus
213 }
214 #endif
215
216
219 #endif /* _ZMOD4XXX_H */
zmod4xxx_read_status
zmod4xxx_err zmod4xxx_read_status(zmod4xxx_dev_t *dev, uint8_t *status)
Read the status of the device.
zmod4xxx_start_measurement
zmod4xxx_err zmod4xxx_start_measurement(zmod4xxx_dev_t *dev)
Start the measurement.
zmod4xxx_calc_single_rmox
float zmod4xxx_calc_single_rmox(zmod4xxx_dev_t *dev, uint8_t *adc_result)
Calculate mox resistance from ADC raw data.
zmod4xxx_err
zmod4xxx_err
error_codes Error codes
Definition: zmod4xxx_types.h:29
zmod4xxx_read_sensor_info
zmod4xxx_err zmod4xxx_read_sensor_info(zmod4xxx_dev_t *dev)
Read sensor parameter.
zmod4xxx_calc_factor
zmod4xxx_err zmod4xxx_calc_factor(zmod4xxx_conf *conf, uint8_t *hsp, uint8_t *config)
Calculate measurement settings.
zmod4xxx_read_rmox
zmod4xxx_err zmod4xxx_read_rmox(zmod4xxx_dev_t *dev, uint8_t *adc_result, float *rmox)
High-level function to read rmox.
zmod4xxx_read_adc_result
zmod4xxx_err zmod4xxx_read_adc_result(zmod4xxx_dev_t *dev, uint8_t *adc_result)
Read adc values from the sensor.
zmod4xxx_start_measurement_at
zmod4xxx_err zmod4xxx_start_measurement_at(zmod4xxx_dev_t *dev, uint8_t step)
Start the measurement at an user-defined sequencer step.
zmod4xxx_init_sensor
zmod4xxx_err zmod4xxx_init_sensor(zmod4xxx_dev_t *dev)
Initialize the sensor after power on.
zmod4xxx_read_tracking_number
zmod4xxx_err zmod4xxx_read_tracking_number(zmod4xxx_dev_t *dev, uint8_t *track_num)
Read tracking number of sensor.
zmod4xxx_null_ptr_check
zmod4xxx_err zmod4xxx_null_ptr_check(zmod4xxx_dev_t *dev)
Check if all function pointers are assigned.
zmod4xxx_types.h
zmod4xxx types
zmod4xxx_dev_t
Device structure ZMOD4xxx.
Definition: zmod4xxx_types.h:100
zmod4xxx_conf
Structure to hold the gas sensor module configuration.
Definition: zmod4xxx_types.h:87
zmod4xxx_prepare_sensor
zmod4xxx_err zmod4xxx_prepare_sensor(zmod4xxx_dev_t *dev)
High-level function to prepare sensor.
zmod4xxx_calc_rmox
zmod4xxx_err zmod4xxx_calc_rmox(zmod4xxx_dev_t *dev, uint8_t *adc_result, float *rmox)
Calculate mox resistance on array of results.
zmod4xxx_init_measurement
zmod4xxx_err zmod4xxx_init_measurement(zmod4xxx_dev_t *dev)
Initialize the sensor for corresponding measurement.
zmod4xxx_check_error_event
zmod4xxx_err zmod4xxx_check_error_event(zmod4xxx_dev_t *dev)
Check the error event of the device.