upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Main Page
Related Pages
UPM Libraries
Namespaces
Data Structures
Files
File List
Globals
src
rsc
rsc_regs.h
1
/*
2
* Author: Abhishek Malik <abhishek.malik@intel.com>
3
* Copyright (c) 2017 Intel Corporation.
4
*
5
* Permission is hereby granted, free of charge, to any person obtaining
6
* a copy of this software and associated documentation files (the
7
* "Software"), to deal in the Software without restriction, including
8
* without limitation the rights to use, copy, modify, merge, publish,
9
* distribute, sublicense, and/or sell copies of the Software, and to
10
* permit persons to whom the Software is furnished to do so, subject to
11
* the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be
14
* included in all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
*/
24
25
#pragma once
26
27
/*
28
* The following section lists the EEPROM Addresses
29
*/
30
/*
31
* RSC EEPROM Catalog listing
32
* This part in the EEPROM stores the ascii representation of the sensor chip
33
* number
34
*/
35
#define RSC_CATALOG_LISTING_MSB 0
36
#define RSC_CATALOG_LISTING_LSB 15
37
38
/*
39
* RSC EEPROM Serial Number addresses
40
*/
41
#define RSC_SERIAL_NO_YYYY_MSB 16
42
#define RSC_SERIAL_NO_YYYY_LSB 19
43
#define RSC_SERIAL_NO_DDD_MSB 20
44
#define RSC_SERIAL_NO_DDD_LSB 22
45
#define RSC_SERIAL_NO_XXXX_MSB 23
46
#define RSC_SERIAL_NO_XXXX_LSB 26
47
48
/*
49
* This area in the EEPROM contains the sensor's pressure range in float
50
*/
51
#define RSC_PRESSURE_RANGE_LSB 27
52
#define RSC_PRESSURE_RANGE_MSB 30
53
54
/*
55
* This part in the EEPROM contains the lower pressure limit readable
56
* Value is stored float
57
*/
58
#define RSC_PRESSURE_MINIMUM_LSB 31
59
#define RSC_PRESSURE_MINIMUM_MSB 34
60
61
/*
62
* Unit of measurement of pressure for this particular sensor
63
* Ex: Pascal, Bar, PSI, inH2O
64
*/
65
#define RSC_PRESSURE_UNIT_MSB 35
66
#define RSC_PRESSURE_UNIT_LSB 39
67
68
/*
69
* Ex: Differential, Gauge, absolute
70
*/
71
#define RSC_PRESSURE_REFERENCE 40
72
73
/*
74
* ADC Configuration math
75
*/
76
#define RSC_ADC_CONDIG_00 61
77
#define RSC_ADC_CONDIG_01 63
78
#define RSC_ADC_CONDIG_02 65
79
#define RSC_ADC_CONDIG_03 67
80
81
/*
82
* Offset Coefficient matrix
83
*/
84
#define RSC_OFFSET_COEFFICIENT_0_LSB 130
85
#define RSC_OFFSET_COEFFICIENT_0_MSB 133
86
87
#define RSC_OFFSET_COEFFICIENT_1_LSB 134
88
#define RSC_OFFSET_COEFFICIENT_1_MSB 137
89
90
#define RSC_OFFSET_COEFFICIENT_2_LSB 138
91
#define RSC_OFFSET_COEFFICIENT_2_MSB 141
92
93
#define RSC_OFFSET_COEFFICIENT_3_LSB 142
94
#define RSC_OFFSET_COEFFICIENT_3_MSB 145
95
96
/*
97
* Span Coefficient Matrix
98
*/
99
#define RSC_SPAN_COEFFICIENT_0_LSB 210
100
#define RSC_SPAN_COEFFICIENT_0_MSB 213
101
102
#define RSC_SPAN_COEFFICIENT_1_LSB 214
103
#define RSC_SPAN_COEFFICIENT_1_MSB 217
104
105
#define RSC_SPAN_COEFFICIENT_2_LSB 218
106
#define RSC_SPAN_COEFFICIENT_2_MSB 221
107
108
#define RSC_SPAN_COEFFICIENT_3_LSB 222
109
#define RSC_SPAN_COEFFICIENT_3_MSB 225
110
111
/*
112
* Shape Coefficient Matrix
113
*/
114
#define RSC_SHAPE_COEFFICIENT_0_LSB 290
115
#define RSC_SHAPE_COEFFICIENT_0_MSB 293
116
117
#define RSC_SHAPE_COEFFICIENT_1_LSB 294
118
#define RSC_SHAPE_COEFFICIENT_1_MSB 297
119
120
#define RSC_SHAPE_COEFFICIENT_2_LSB 298
121
#define RSC_SHAPE_COEFFICIENT_2_MSB 301
122
123
#define RSC_SHAPE_COEFFICIENT_3_LSB 302
124
#define RSC_SHAPE_COEFFICIENT_3_MSB 305
125
126
/*
127
* Checksum addresses
128
*/
129
#define RSC_CHECKSUM_LSB 450
130
#define RSC_CHECKSUM_MSB 451
131
132
/*
133
* The following section contains a list of variations useful for EEPROM
134
* calculations and reads.
135
*/
136
#define RSC_EEPROM_ADDRESS_SPACE_SIZE 512
137
#define RSC_EEPROM_STANDARD_ARGUMENT_LENGTH 2
138
#define RSC_READ_EEPROM_INSTRUCTION 0x03
139
#define RSC_EEPROM_ADDRESS_LOWER_BYTE_MASK 0xff
140
#define RSC_EEPROM_ADDRESS_9TH_BIT_MASK 0x100
141
#define RSC_SENSOR_NAME_LEN 16
142
#define RSC_SENSOR_NUMBER_LEN 12
143
#define RSC_PRESSURE_RANGE_LEN 4
144
#define RSC_PRESSURE_MINIMUM_LEN 4
145
#define RSC_PRESSURE_UNIT_LEN 6
146
#define RSC_SENSOR_TYPE_LEN 1
147
// total types of coefficients
148
#define RSC_COEFF_T_ROW_NO 3
149
// total no of coefficients in each type
150
#define RSC_COEFF_T_COL_NO 4
151
// this can be calculated by using the LSB address of the 0th coefficient
152
// and the MSB of the 3rd coefficient
153
#define RSC_COEFF_ADDRESS_SPACE_SIZE 16
154
155
/*
156
* The following section lists ADC Commands/Registers
157
*/
158
#define RSC_ADC_RESET_COMMAND 0x06
159
#define RSC_DATA_RATE_SHIFT 5
160
#define RSC_DATA_RATE_MASK 0xe0
161
#define RSC_ADC_REG_MASK 0x0C
162
#define RSC_ADC_NUM_BYTES_MASK 0x03
163
#define RSC_OPERATING_MODE_MASK 0x18
164
#define RSC_OPERATING_MODE_SHIFT 3
165
#define RSC_SET_BITS_MASK 0x04
166
#define RSC_ADC_WREG 0x40
167
#define MSEC_PER_SEC 1000
168
#define RSC_CREATE_WREG_COMMAND(x,y,z) (x|((y<<2)&RSC_ADC_REG_MASK)|(z&RSC_ADC_NUM_BYTES_MASK))
169
170
/*
171
* Read/Write Enum
172
*/
173
typedef
enum
{
174
READ = 0,
175
WRITE } RSC_ADC_TX;
176
177
/*
178
* Enum for the datarates supported by the sensor
179
* N/F - Normal/Fast - 256 KHz/512 KHz
180
* DR - Data Rate
181
* SPS - Samples per second
182
*/
183
typedef
enum
{
184
N_DR_20_SPS = 0,
185
N_DR_45_SPS,
186
N_DR_90_SPS,
187
N_DR_175_SPS,
188
N_DR_330_SPS,
189
N_DR_600_SPS,
190
N_DR_1000_SPS,
191
N_DR_NA,
192
F_DR_40_SPS,
193
F_DR_90_SPS,
194
F_DR_180_SPS,
195
F_DR_350_SPS,
196
F_DR_660_SPS,
197
F_DR_1200_SPS,
198
F_DR_2000_SPS,
199
F_DR_NA } RSC_DATA_RATE;
200
201
/*
202
* Enum for modes supported by the RSC sensor
203
*/
204
typedef
enum
{
205
NORMAL_MODE = 0,
206
NA_MODE,
207
FAST_MODE } RSC_MODE;
208
209
/*
210
* Enum for the different pressure units supported by the rsc class of sensors
211
*/
212
typedef
enum
{
213
PASCAL = 0,
214
KPASCAL,
215
MPASCAL,
216
PSI,
217
INH2O,
218
BAR,
219
mBAR } PRESSURE_U;
220
221
/*
222
* Enum for types of pressure that the rsc sensor class can calculate
223
*/
224
typedef
enum
{
225
DIFFERENTIAL = 0,
226
ABSOLUTE,
227
GAUGE } PRESSURE_T;
228
229
/*
230
* Enum for types of coefficients available from the rsc sensors
231
*/
232
typedef
enum
{
233
OFFSET = 0,
234
SPAN,
235
SHAPE } COEFFICIENT_T;
236
237
/*
238
* Enum for pressure/temperature reading
239
*/
240
typedef
enum
{
241
PRESSURE = 0,
242
TEMPERATURE } READING_T;
243
244
/*
245
* Enum to access EEPROM/ADC
246
*/
247
typedef
enum
{
248
EEPROM = 0,
249
ADC } ACCESS_T;
Generated on Wed Nov 21 2018 10:43:52 for upm by
1.8.11