ZMOD4510 Nitrogen Dioxide and Ozone Firmware Documentation |

zmod4xxx_types.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_TYPES_H
20 #define _ZMOD4XXX_TYPES_H
21
22 #include <stdint.h>
23 #include <stdio.h>
24
25
29 typedef enum {
30 ZMOD4XXX_OK = 0,
31 ERROR_INIT_OUT_OF_RANGE =
32 -1,
33 ERROR_GAS_TIMEOUT =
34 -2,
36 ERROR_I2C = -3,
37 ERROR_SENSOR_UNSUPPORTED =
38 -4,
40 ERROR_CONFIG_MISSING =
41 -5,
42 ERROR_ACCESS_CONFLICT =
43 -6,
45 ERROR_POR_EVENT =
46 -7,
47 ERROR_CLEANING =
48 -8,
50 ERROR_NULL_PTR =
51 -9
53 } zmod4xxx_err;
54
65 typedef int8_t (*zmod4xxx_i2c_ptr_t)(uint8_t addr, uint8_t reg_addr,
66 uint8_t *data_buf, uint8_t len);
67
73 typedef void (*zmod4xxx_delay_ptr_p)(uint32_t ms);
74
78 typedef struct {
79 uint8_t addr;
80 uint8_t len;
81 uint8_t *data_buf;
82 } zmod4xxx_conf_str;
83
87 typedef struct {
88 uint8_t start;
89 zmod4xxx_conf_str h;
90 zmod4xxx_conf_str d;
91 zmod4xxx_conf_str m;
92 zmod4xxx_conf_str s;
93 zmod4xxx_conf_str r;
94 uint8_t prod_data_len;
95 } zmod4xxx_conf;
96
100 typedef struct {
101 uint8_t i2c_addr;
102 uint8_t config[6];
103 uint16_t mox_er;
104 uint16_t mox_lr;
105 uint16_t pid;
106 uint8_t *prod_data;
107 zmod4xxx_i2c_ptr_t read;
108 zmod4xxx_i2c_ptr_t write;
109 zmod4xxx_delay_ptr_p delay_ms;
110 zmod4xxx_conf *init_conf;
111 zmod4xxx_conf *meas_conf;
112 } zmod4xxx_dev_t;
113
116 #endif /* _ZMOD4XXX_TYPES_H */
zmod4xxx_dev_t::meas_conf
zmod4xxx_conf * meas_conf
Definition: zmod4xxx_types.h:111
ERROR_SENSOR_UNSUPPORTED
Definition: zmod4xxx_types.h:37
zmod4xxx_delay_ptr_p
void(* zmod4xxx_delay_ptr_p)(uint32_t ms)
function pointer to hardware dependent delay function
Definition: zmod4xxx_types.h:73
ERROR_INIT_OUT_OF_RANGE
Definition: zmod4xxx_types.h:31
zmod4xxx_dev_t::i2c_addr
uint8_t i2c_addr
Definition: zmod4xxx_types.h:101
zmod4xxx_i2c_ptr_t
int8_t(* zmod4xxx_i2c_ptr_t)(uint8_t addr, uint8_t reg_addr, uint8_t *data_buf, uint8_t len)
function pointer type for i2c access
Definition: zmod4xxx_types.h:65
zmod4xxx_err
zmod4xxx_err
error_codes Error codes
Definition: zmod4xxx_types.h:29
zmod4xxx_dev_t::pid
uint16_t pid
Definition: zmod4xxx_types.h:105
ERROR_CLEANING
Definition: zmod4xxx_types.h:47
ERROR_POR_EVENT
Definition: zmod4xxx_types.h:45
zmod4xxx_conf_str
A single data set for the configuration.
Definition: zmod4xxx_types.h:78
zmod4xxx_dev_t::delay_ms
zmod4xxx_delay_ptr_p delay_ms
Definition: zmod4xxx_types.h:109
zmod4xxx_dev_t::mox_lr
uint16_t mox_lr
Definition: zmod4xxx_types.h:104
ERROR_ACCESS_CONFLICT
Definition: zmod4xxx_types.h:42
ERROR_NULL_PTR
Definition: zmod4xxx_types.h:50
zmod4xxx_dev_t::prod_data
uint8_t * prod_data
Definition: zmod4xxx_types.h:106
zmod4xxx_dev_t::write
zmod4xxx_i2c_ptr_t write
Definition: zmod4xxx_types.h:108
zmod4xxx_dev_t::mox_er
uint16_t mox_er
Definition: zmod4xxx_types.h:103
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
ERROR_GAS_TIMEOUT
Definition: zmod4xxx_types.h:33
zmod4xxx_dev_t::read
zmod4xxx_i2c_ptr_t read
Definition: zmod4xxx_types.h:107
ERROR_I2C
Definition: zmod4xxx_types.h:36
zmod4xxx_dev_t::init_conf
zmod4xxx_conf * init_conf
Definition: zmod4xxx_types.h:110
ERROR_CONFIG_MISSING
Definition: zmod4xxx_types.h:40