RRH46410 Firmware Documentation
rrh46410.h
Go to the documentation of this file.
1 
10 #ifndef RRH46410_H
11 #define RRH46410_H
12 
13 #include <stdint.h>
14 #include "hal/hal.h"
15 
19 typedef enum {
20  omSuspend = 0x00,
21  omIAQ2 = 0x01,
22  omIAQ2_ULP = 0x02,
23  omPBAQ = 0x05,
24  omCleaning = 0x80,
25  omUnknown = 0xff
27 
28 
32 typedef enum {
37  cmdSetHumidity = 0x12,
38  cmdGetResults = 0x18,
40  cmdGetGPIOState = 0x21,
42  cmdSetOutputLow = 0x23,
43  cmdGetDebugData = 0x31,
46 
50 typedef struct {
51  uint8_t sampleID;
53 
54 
58 typedef struct {
59  uint8_t sampleID;
60  uint8_t iaq;
61  uint16_t tvoc;
62  uint16_t etoh;
63  uint16_t eco2;
64  uint8_t rel_IAQ;
66 
67 
71 typedef struct {
72  uint8_t sampleID;
73  uint16_t tvoc;
74  uint16_t etoh;
76 
77 
78 
82 typedef union {
87 
88 
92 typedef union {
93  uint8_t sampleID;
94  uint8_t raw [ 100 ];
96 
97 
101 typedef enum {
102  /* sensor generated errors */
103  ecWarmup = 0x01,
105  ecPOR = 0x09,
106  ecDamage = 0x0a,
107  ecDataNotReady = 0x10,
108  ecInternalComm = 0x20,
111  /* locally generated errors */
112  ecSampleNotNew = 0x100,
117 
118 
122 typedef struct {
125  uint8_t i2cAddress;
127  uint8_t resultsLength;
128  uint8_t debugLength;
131  uint8_t recentsampleID;
132  uint8_t remainingWarmup;
133 } RRH46410_t;
134 
135 
139 typedef struct {
140  uint16_t productId;
142  uint8_t trackingNumber [ 6 ];
143  struct {
144  uint8_t major;
145  uint8_t minor;
146  uint8_t patch;
147  } fwVersion;
149 
150 
172 int RRH46410_Init ( RRH46410_t* sensor, Interface_t* hal );
173 
184 
199 int RRH46410_ReadOperatingMode ( RRH46410_t* sensor );
200 
201 
216 
217 
231 int RRH46410_SetHumidity ( RRH46410_t* sensor, float humidity );
232 
233 
246 int RRH46410_ReadResults ( RRH46410_t* sensor, void* result );
247 
248 
267 int RRH46410_ReadDebug ( RRH46410_t* sensor, void* result );
268 
269 
286 int RRH46410_PerformCleaning ( RRH46410_t* sensor );
287 
288 
303 int RRH46410_Reset ( RRH46410_t* sensor );
304 
305 
319 int RRH46410_SoftReset ( RRH46410_t* sensor );
320 
321 
335 int RRH46410_ConfigureGPIO ( RRH46410_t* sensor, uint8_t outputMask );
336 
337 
356 int RRH46410_WriteGPIO ( RRH46410_t* sensor, uint8_t mask, uint8_t state );
357 
358 
371 int RRH46410_ReadGPIO ( RRH46410_t* sensor, uint8_t* state );
372 
373 
374 #endif /* RRH46410_H */
375 
int RRH46410_ReadResults(RRH46410_t *sensor, void *result)
Read latest sensor results.
uint32_t measurementInterval
Definition: rrh46410.h:129
Definition: rrh46410.h:35
Definition: rrh46410.h:106
Debug output data structure.
Definition: rrh46410.h:92
int RRH46410_Reset(RRH46410_t *sensor)
Reset the sensor.
Definition: rrh46410.h:22
Definition: rrh46410.h:113
uint16_t tvoc
Definition: rrh46410.h:61
Definition: rrh46410.h:112
int RRH46410_PerformCleaning(RRH46410_t *sensor)
Perform sensor cleaning.
Definition: rrh46410.h:108
Results returned from sensor in IAQ2 and IAQ2 ULP mode.
Definition: rrh46410.h:58
uint8_t sampleID
Definition: rrh46410.h:51
uint8_t remainingWarmup
Definition: rrh46410.h:132
uint16_t productId
Definition: rrh46410.h:140
Definition: rrh46410.h:25
Definition: rrh46410.h:21
Definition: rrh46410.h:104
Renesas Environmental Sensor HAL definitions.
Definition: rrh46410.h:20
int RRH46410_ReadGPIO(RRH46410_t *sensor, uint8_t *state)
Read the state of all GPIO pins.
Definition: rrh46410.h:38
Definition: rrh46410.h:41
uint8_t iaq
Definition: rrh46410.h:60
int RRH46410_ConfigureGPIO(RRH46410_t *sensor, uint8_t outputMask)
Configure GPIO1 and GPIO2 direction.
int RRH46410_ReadOperatingMode(RRH46410_t *sensor)
Read the current operating mode.
Definition: rrh46410.h:107
int RRH46410_GetSensorInfo(RRH46410_t *sensor, RRH46410_SensorInfo_t *info)
Read additional sensor information.
Definition: rrh46410.h:114
RRH46410_ErrorCodes_t
Definition of error codes for RRH46410 sensors.
Definition: rrh46410.h:101
Definition: rrh46410.h:33
RRH46410_IAQ2_Results_t iaq2
Definition: rrh46410.h:84
Definition: rrh46410.h:24
int RRH46410_SoftReset(RRH46410_t *sensor)
Perform a software reset.
Definition: rrh46410.h:115
Definition: rrh46410.h:105
Definition: rrh46410.h:37
Generic result data structure, joining the results of the different operating modes.
Definition: rrh46410.h:82
Definition: rrh46410.h:40
Definition: rrh46410.h:34
Sensor information data structure.
Definition: rrh46410.h:139
uint16_t eco2
Definition: rrh46410.h:63
Definition: rrh46410.h:110
Raw result returned from sensor in PBAQ mode.
Definition: rrh46410.h:71
RRH46410_Common_Results_t common
Definition: rrh46410.h:83
A structure of pointers to hardware specific functions.
Definition: hal.h:69
RRH46410_OperatingMode_t
Operating mode types.
Definition: rrh46410.h:19
Definition: rrh46410.h:109
Definition: rrh46410.h:44
int RRH46410_WriteGPIO(RRH46410_t *sensor, uint8_t mask, uint8_t state)
Write one or multiple GPIO pins.
Data structure holding information required for RRH46410 API operation.
Definition: rrh46410.h:122
Definition: rrh46410.h:23
uint8_t resultsLength
Definition: rrh46410.h:127
Definition: rrh46410.h:36
Definition: rrh46410.h:103
RRH46410_OperatingMode_t operatingMode
Definition: rrh46410.h:126
uint8_t debugLength
Definition: rrh46410.h:128
uint8_t i2cAddress
Definition: rrh46410.h:125
Interface_t * hal
Definition: rrh46410.h:123
This struct helps accessing sample ID independent from operating mode.
Definition: rrh46410.h:50
Definition: rrh46410.h:39
uint16_t etoh
Definition: rrh46410.h:62
int RRH46410_ReadDebug(RRH46410_t *sensor, void *result)
Read debug output.
Definition: rrh46410.h:42
int RRH46410_SetHumidity(RRH46410_t *sensor, float humidity)
Set humidity value to be used in gas algorithm computations.
uint8_t recentsampleID
Definition: rrh46410.h:131
int RRH46410_Init(RRH46410_t *sensor, Interface_t *hal)
Initialize sensor object.
RRH46410_PBAQ_Results_t pbaq
Definition: rrh46410.h:85
Definition: rrh46410.h:43
int RRH46410_SetOperatingMode(RRH46410_t *sensor, RRH46410_OperatingMode_t mode)
Set the current operating mode.
RRH46410_Commands_t
Define names for RRH46410 commands.
Definition: rrh46410.h:32
uint8_t rel_IAQ
Definition: rrh46410.h:64