MVMFirmwareCpp v0.1
driver_SFM3019.cpp
Go to the documentation of this file.
1 //
2 //
3 //
4 
5 #include "driver_SFM3019.h"
6 
7 
8 
9 
10 #define SENSIRION_BIG_ENDIAN 0
11 #define SFM3019_I2C_ADDRESS 0x2E
12 
13 #define SFM3019_CMD_START_CONTINUOUS_MEASUREMENT_O2 \
14  SFM_CMD_START_CONTINUOUS_MEASUREMENT_GAS0
15 #define SFM3019_CMD_START_CONTINUOUS_MEASUREMENT_AIR \
16  SFM_CMD_START_CONTINUOUS_MEASUREMENT_GAS1
17 #define SFM3019_CMD_START_CONTINUOUS_MEASUREMENT_AIR_O2_MIX \
18  SFM_CMD_START_CONTINUOUS_MEASUREMENT_GAS_MIX_0
19 
20 #define SFM3019_SOFT_RESET_TIME_US 2000
21 #define SENSIRION_I2C_CLOCK_PERIOD_USEC 10
22 
23 
24 #define STATUS_OK 0
25 #define STATUS_FAIL (-1)
26 
27 #if SENSIRION_BIG_ENDIAN
28 #define be16_to_cpu(s) (s)
29 #define be32_to_cpu(s) (s)
30 #define be64_to_cpu(s) (s)
31 #define SENSIRION_WORDS_TO_BYTES(a, w) ()
32 
33 #else /* SENSIRION_BIG_ENDIAN */
34 
35 #define be16_to_cpu(s) (((uint16_t)(s) << 8) | (0xff & ((uint16_t)(s)) >> 8))
36 #define be32_to_cpu(s) \
37  (((uint32_t)be16_to_cpu(s) << 16) | (0xffff & (be16_to_cpu((s) >> 16))))
38 #define be64_to_cpu(s) \
39  (((uint64_t)be32_to_cpu(s) << 32) | \
40  (0xffffffff & ((uint64_t)be32_to_cpu((s) >> 32))))
41 
47 #define SENSIRION_WORDS_TO_BYTES(a, w) \
48  for (uint16_t *__a = (uint16_t *)(a), __e = (w), __w = 0; __w < __e; \
49  ++__w) { \
50  __a[__w] = be16_to_cpu(__a[__w]); \
51  }
52 #endif /* SENSIRION_BIG_ENDIAN */
53 
54 #ifndef ARRAY_SIZE
55 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
56 #endif
57 
58 #define CRC8_POLYNOMIAL 0x31
59 #define CRC8_INIT 0xFF
60 #define CRC8_LEN 1
61 
62 #define SENSIRION_COMMAND_SIZE 2
63 #define SENSIRION_WORD_SIZE 2
64 #define SENSIRION_NUM_WORDS(x) (sizeof(x) / SENSIRION_WORD_SIZE)
65 #define SENSIRION_MAX_BUFFER_WORDS 32
66 
67 
68 #define SFM_CMD_READ_PRODUCT_IDENTIFIER 0xE102
69 
70 #define SFM_CMD_READ_SCALE_FACTOR_OFFSET_AND_FLOW_UNIT 0x3661
71 
72 #define SFM_CMD_STOP_CONTINUOUS_MEASUREMENT 0x3FF9
73 
74 
75 
76 const char* SFM_DRV_VERSION_STR = "0.1.0";
77 
78 
79 uint8_t SensorSFM3019::sensirion_common_generate_crc(uint8_t* data, uint16_t count) {
80  uint16_t current_byte;
81  uint8_t crc = CRC8_INIT;
82  uint8_t crc_bit;
83 
84  /* calculates 8-Bit checksum with given polynomial */
85  for (current_byte = 0; current_byte < count; ++current_byte) {
86  crc ^= (data[current_byte]);
87  for (crc_bit = 8; crc_bit > 0; --crc_bit) {
88  if (crc & 0x80)
89  crc = (crc << 1) ^ CRC8_POLYNOMIAL;
90  else
91  crc = (crc << 1);
92  }
93  }
94  return crc;
95 }
96 
97 int8_t SensorSFM3019::sensirion_common_check_crc(uint8_t* data, uint16_t count,
98  uint8_t checksum) {
99  if (sensirion_common_generate_crc(data, count) != checksum)
100  return STATUS_FAIL;
101  return STATUS_OK;
102 }
103 
105  const uint8_t data = 0x06;
106  hwi->I2CWrite(IIC_GENERAL_CALL_SENSIRION, (uint8_t *)&data, (uint16_t)sizeof(data), true);
107  return 0;
108 }
109 
110 uint16_t SensorSFM3019::sensirion_fill_cmd_send_buf(uint8_t* buf, uint16_t cmd,
111  const uint16_t* args, uint8_t num_args) {
112  uint8_t crc;
113  uint8_t i;
114  uint16_t idx = 0;
115 
116  buf[idx++] = (uint8_t)((cmd & 0xFF00) >> 8);
117  buf[idx++] = (uint8_t)((cmd & 0x00FF) >> 0);
118 
119  for (i = 0; i < num_args; ++i) {
120  buf[idx++] = (uint8_t)((args[i] & 0xFF00) >> 8);
121  buf[idx++] = (uint8_t)((args[i] & 0x00FF) >> 0);
122 
123  crc = sensirion_common_generate_crc((uint8_t*)&buf[idx - 2],
125  buf[idx++] = crc;
126  }
127  return idx;
128 }
129 
130 int16_t SensorSFM3019::sensirion_i2c_read_words_as_bytes(uint8_t address, uint8_t* data,
131  uint16_t num_words) {
132  int16_t ret;
133  uint16_t i, j;
134  uint16_t size = num_words * (SENSIRION_WORD_SIZE + CRC8_LEN);
135  uint16_t word_buf[SENSIRION_MAX_BUFFER_WORDS];
136  uint8_t* const buf8 = (uint8_t*)word_buf;
137 
138  ret = sensirion_i2c_read(address, buf8, size);
139  if (ret != STATUS_OK)
140  return ret;
141 
142  /* check the CRC for each word */
143  for (i = 0, j = 0; i < size; i += SENSIRION_WORD_SIZE + CRC8_LEN) {
144 
146  buf8[i + SENSIRION_WORD_SIZE]);
147  if (ret != STATUS_OK)
148  return ret;
149 
150  data[j++] = buf8[i];
151  data[j++] = buf8[i + 1];
152  }
153 
154  return STATUS_OK;
155 }
156 
157 int16_t SensorSFM3019::sensirion_i2c_read_words(uint8_t address, uint16_t* data_words,
158  uint16_t num_words) {
159  int16_t ret;
160  uint8_t i;
161 
162  ret = sensirion_i2c_read_words_as_bytes(address, (uint8_t*)data_words,
163  num_words);
164  if (ret != STATUS_OK)
165  return ret;
166 
167  for (i = 0; i < num_words; ++i)
168  data_words[i] = be16_to_cpu(data_words[i]);
169 
170  return STATUS_OK;
171 }
172 
173 int16_t SensorSFM3019::sensirion_i2c_write_cmd(uint8_t address, uint16_t command) {
174  uint8_t buf[SENSIRION_COMMAND_SIZE];
175 
176  sensirion_fill_cmd_send_buf(buf, command, NULL, 0);
177  return sensirion_i2c_write(address, buf, SENSIRION_COMMAND_SIZE);
178 }
179 
180 int16_t SensorSFM3019::sensirion_i2c_write_cmd_with_args(uint8_t address, uint16_t command,
181  const uint16_t* data_words,
182  uint16_t num_words) {
183  uint8_t buf[SENSIRION_MAX_BUFFER_WORDS];
184  uint16_t buf_size;
185 
186  buf_size = sensirion_fill_cmd_send_buf(buf, command, data_words, num_words);
187  return sensirion_i2c_write(address, buf, buf_size);
188 }
189 
190 int16_t SensorSFM3019::sensirion_i2c_delayed_read_cmd(uint8_t address, uint16_t cmd,
191  uint32_t delay_us, uint16_t* data_words,
192  uint16_t num_words) {
193  int16_t ret;
194  uint8_t buf[SENSIRION_COMMAND_SIZE];
195 
196  sensirion_fill_cmd_send_buf(buf, cmd, NULL, 0);
197  ret = sensirion_i2c_write(address, buf, SENSIRION_COMMAND_SIZE);
198  if (ret != STATUS_OK)
199  return ret;
200 
201  if (delay_us)
202  sensirion_sleep_usec(delay_us);
203 
204  return sensirion_i2c_read_words(address, data_words, num_words);
205 }
206 
207 int16_t SensorSFM3019::sensirion_i2c_read_cmd(uint8_t address, uint16_t cmd,
208  uint16_t* data_words, uint16_t num_words) {
209  return sensirion_i2c_delayed_read_cmd(address, cmd, 0, data_words,
210  num_words);
211 }
212 
213 
214 
215 
216 int8_t SensorSFM3019::sensirion_i2c_read(uint8_t address, uint8_t* data, uint16_t count) {
217  uint8_t readData[32];
218  uint8_t rxByteCount = 0;
219 
220 
221  hwi->I2CRead(i2c_device, readData, count,true);
222 
223  memcpy(data, readData, count);
224 
225  return 0;
226 }
227 
228 int8_t SensorSFM3019::sensirion_i2c_write(uint8_t address, const uint8_t* data,
229  uint16_t count) {
230 
231 
232  hwi->I2CWrite(i2c_device, (uint8_t*)data, count, true);
233 
234 
235  return 0;
236 }
237 
244 void SensorSFM3019::sensirion_sleep_usec(uint32_t useconds) {
245  hwi->__delay_blocking_ms((useconds / 1000) + 1);
246 }
247 
248 
250  return SFM_DRV_VERSION_STR;
251 }
252 
253 int16_t SensorSFM3019::sfm_common_probe(uint8_t i2c_address) {
254  uint16_t buf[6];
256  buf, 6);
257 }
258 
260  uint32_t* product_number,
261  uint8_t(*serial_number)[8]) {
262  uint8_t buf[6 * 2];
263  int16_t error =
265  if (error) {
266  return error;
267  }
269  if (error) {
270  return error;
271  }
272  if (product_number) {
273  *product_number = ((uint32_t)buf[0] << 24) + ((uint32_t)buf[1] << 16) +
274  ((uint32_t)buf[2] << 8) + (uint32_t)buf[3];
275  }
276  if (serial_number) {
277  for (size_t i = 0; i < 8; ++i) {
278  (*serial_number)[i] = buf[i + 4];
279  }
280  }
281  return 0;
282 }
283 
285  const SfmConfig* sfm_config,
286  SfmCmdStartContinuousMeasurement measurement_cmd, int16_t* flow_scale,
287  int16_t* flow_offset, uint16_t* unit) {
288 
289  uint16_t measurement_cmd_word = (uint16_t)measurement_cmd;
290 
291  uint16_t buf[3];
292  int16_t error = sensirion_i2c_write_cmd_with_args(
294  &measurement_cmd_word, 1);
295  if (error) {
296  return error;
297  }
298  error =
299  sensirion_i2c_read_words(sfm_config->i2c_address, buf, ARRAY_SIZE(buf));
300 
301  if (error) {
302  return error;
303  }
304  if (flow_scale) {
305  *flow_scale = (int16_t)buf[0];
306  }
307  if (flow_offset) {
308  *flow_offset = (int16_t)buf[1];
309  }
310  if (unit) {
311  *unit = buf[2];
312  }
313  return 0;
314 }
315 
317  int16_t flow_raw, float* flow) {
318  if (sfm_config->flow_scale == 0) {
319  return -1;
320  }
321 
322  *flow =
323  (flow_raw - sfm_config->flow_offset) / (float)(sfm_config->flow_scale);
324 
325  return 0;
326 }
327 
329  return temperature_raw / 200.0f;
330 }
331 
333  SfmConfig* sfm_config, SfmCmdStartContinuousMeasurement measurement_cmd) {
334 
336  sfm_config, measurement_cmd, &sfm_config->flow_scale,
337  &sfm_config->flow_offset, NULL);
338  if (error) {
339  return error;
340  }
341 
342  return sensirion_i2c_write_cmd(sfm_config->i2c_address, measurement_cmd);
343 }
344 
346  int16_t* flow_raw,
347  int16_t* temperature_raw,
348  uint16_t* status) {
349  uint16_t buf[3] = {};
350  int16_t error = sensirion_i2c_read_words(sfm_config->i2c_address, buf, 3);
351  if (error) {
352  return error;
353  }
354  if (flow_raw) {
355  *flow_raw = (int16_t)buf[0];
356  }
357  if (temperature_raw) {
358  *temperature_raw = (int16_t)buf[1];
359  }
360  if (status) {
361  *status = buf[2];
362  }
363  return 0;
364 }
365 
367  sfm_config->flow_scale = 0;
368  sfm_config->flow_offset = 0;
369  return sensirion_i2c_write_cmd(sfm_config->i2c_address,
371 }
372 
373 
376 }
377 
379  SfmConfig sfm_config = {
380  i2c_address,
381  0,
382  0,
383  };
384  return sfm_config;
385 }
386 
387 
388 
389 bool SensorSFM3019::Init(t_i2cdevices device, void* hw_handle)
390 {
391 
392  DriverContext* dc;
393  dc = (DriverContext*)hw_handle;
394  hwi = (HW*)dc->hwi;
395  dbg = (DebugIfaceClass*)dc->dbg;
396  i2c_address = 0x2e;
397  i2c_device = device;
398 
399  _initialized = false;
400  const char* driver_version = sfm_common_get_driver_version();
401  if (driver_version) {
402  dbg->DbgPrint(DBG_KERNEL, DBG_INFO, "SFM driver version " + String(driver_version));
403  }
404  else {
405  dbg->DbgPrint(DBG_KERNEL, DBG_ERROR, "SFM fatal: Getting driver version failed");
406  return false;
407  }
408 
409  int16_t error;
410 
411  /* Reset all I2C devices */
413  if (error) {
414  dbg->DbgPrint(DBG_KERNEL, DBG_ERROR, "General call reset failed");
415  return false;
416  }
417  /* Wait for the SFM3019 to initialize */
419 
420  uint32_t timeout = millis();
421  while (sfm3019_probe()) {
422  dbg->DbgPrint(DBG_KERNEL, DBG_ERROR, "SFM sensor probing failed");
423  if (millis() - timeout > 1000)
424  return false;
425  hwi->__delay_blocking_ms(10);
426  }
427 
428  uint32_t product_number = 0;
429  uint8_t serial_number[8] = {};
431  &product_number, &serial_number);
432  if (error) {
433  dbg->DbgPrint(DBG_KERNEL, DBG_ERROR, "Failed to read product identifier");
434  return false;
435  }
436  else {
437  dbg->DbgPrint(DBG_KERNEL, DBG_WARNING, "Product: " + String(product_number));
438  for (size_t i = 0; i < 8; ++i) {
439  dbg->DbgPrint(DBG_KERNEL, DBG_WARNING, String(serial_number[i]));
440  }
441  }
442 
443  hwi->__delay_blocking_ms(1000);
445 
448  if (error) {
449  dbg->DbgPrint(DBG_KERNEL, DBG_ERROR, "Failed to start measurement");
450  }
451 
452  /* Wait for the first measurement to be available. Wait for
453  * SFM3019_MEASUREMENT_WARM_UP_TIME_US instead for more reliable results */
454  hwi->__delay_blocking_ms(100);
455 
456  _initialized = true;
457  return true;
458 }
459 
460 
461 bool SensorSFM3019::doMeasure(float* Flow, float* T)
462 {
463  int16_t flow_raw;
464  int16_t temperature_raw;
465  uint16_t status;
466  int16_t error;
467  if (!_initialized) return false;
468 
469  error = sfm_common_read_measurement_raw(&sfm3019, &flow_raw,
470  &temperature_raw, &status);
471  if (error) {
472  //Serial.println("Error while reading measurement");
473  return false;
474  }
475  else {
476  float flow;
477  float temperature;
478  error = sfm_common_convert_flow_float(&sfm3019, flow_raw, &flow);
479  if (error) {
480  //Serial.println("Error while converting flow");
481  return false;
482  }
483  *T = sfm_common_convert_temperature_float(temperature_raw);
484  *Flow = flow;
485  Integral += flow;
486  //Serial.println("Flow: " + String(flow) + " flow_raw: " + String(flow_raw) + " T: " +String(temperature) + " Traw: " +String(temperature_raw) + " status: " + String(status));
487  }
488 }
489 
491 {
492  return Integral;
493 }
495 {
496  Integral = 0;
497 }
498 
499 
500 // # # ###
501 // ## # #
502 // # # # #
503 // # # # #
504 // # # # #
505 // # ## #
506 // # # ###
507 //
508 // Nuclear Instruments 2020 - All rights reserved
509 // Any commercial use of this code is forbidden
510 // Contact info@nuclearinstruments.eu
SensorSFM3019::ResetIntegral
void ResetIntegral()
Definition: driver_SFM3019.cpp:494
SFM3019_CMD_START_CONTINUOUS_MEASUREMENT_AIR
#define SFM3019_CMD_START_CONTINUOUS_MEASUREMENT_AIR
Definition: driver_SFM3019.cpp:15
DriverContext::dbg
DebugIfaceClass * dbg
Definition: DriverContext.h:7
SensorSFM3019::Init
bool Init(t_i2cdevices device, void *hw_handle)
Definition: driver_SFM3019.cpp:389
SensorSFM3019::sensirion_i2c_write
int8_t sensirion_i2c_write(uint8_t address, const uint8_t *data, uint16_t count)
Definition: driver_SFM3019.cpp:228
DBG_INFO
@ DBG_INFO
Definition: DebugIface.h:21
HW_V4::I2CRead
bool I2CRead(t_i2cdevices device, uint8_t *wbuffer, int wlength, uint8_t *rbuffer, int rlength, bool stop)
Write buffer to I2C bus and read data.
Definition: fw_board_ni_v4.cpp:182
SensorSFM3019::i2c_address
uint8_t i2c_address
Definition: driver_SFM3019.h:44
SensorSFM3019::sfm_common_get_driver_version
const char * sfm_common_get_driver_version(void)
Definition: driver_SFM3019.cpp:249
SFM_DRV_VERSION_STR
const char * SFM_DRV_VERSION_STR
Definition: driver_SFM3019.cpp:76
SensorSFM3019::GetIntegral
float GetIntegral()
Definition: driver_SFM3019.cpp:490
SensorSFM3019::sensirion_common_check_crc
int8_t sensirion_common_check_crc(uint8_t *data, uint16_t count, uint8_t checksum)
Definition: driver_SFM3019.cpp:97
SensorSFM3019::i2c_device
t_i2cdevices i2c_device
Definition: driver_SFM3019.h:45
DriverContext
Definition: DriverContext.h:5
SensorSFM3019::sfm_common_convert_temperature_float
float sfm_common_convert_temperature_float(int16_t temperature_raw)
Definition: driver_SFM3019.cpp:328
CRC8_LEN
#define CRC8_LEN
Definition: driver_SFM3019.cpp:60
SensorSFM3019::doMeasure
bool doMeasure(float *Flow, float *T)
Definition: driver_SFM3019.cpp:461
SensorSFM3019::_initialized
bool _initialized
Definition: driver_SFM3019.h:52
SensorSFM3019::sfm_common_stop_continuous_measurement
int16_t sfm_common_stop_continuous_measurement(SfmConfig *sfm_config)
Definition: driver_SFM3019.cpp:366
SensorSFM3019::sfm_common_convert_flow_float
int16_t sfm_common_convert_flow_float(const SfmConfig *sfm_config, int16_t flow_raw, float *flow)
Definition: driver_SFM3019.cpp:316
SensorSFM3019::sensirion_i2c_read_words_as_bytes
int16_t sensirion_i2c_read_words_as_bytes(uint8_t address, uint8_t *data, uint16_t num_words)
Definition: driver_SFM3019.cpp:130
SensorSFM3019::Integral
float Integral
Definition: driver_SFM3019.h:51
HW_V4::I2CWrite
bool I2CWrite(t_i2cdevices device, uint8_t *wbuffer, int wlength, bool stop)
Write buffer to I2C bus.
Definition: fw_board_ni_v4.cpp:145
SensorSFM3019::sensirion_common_generate_crc
uint8_t sensirion_common_generate_crc(uint8_t *data, uint16_t count)
Definition: driver_SFM3019.cpp:79
SFM_CMD_READ_PRODUCT_IDENTIFIER
#define SFM_CMD_READ_PRODUCT_IDENTIFIER
Definition: driver_SFM3019.cpp:68
STATUS_FAIL
#define STATUS_FAIL
Definition: driver_SFM3019.cpp:25
SFM_CMD_STOP_CONTINUOUS_MEASUREMENT
#define SFM_CMD_STOP_CONTINUOUS_MEASUREMENT
Definition: driver_SFM3019.cpp:72
DBG_ERROR
@ DBG_ERROR
Definition: DebugIface.h:19
SensorSFM3019::sfm_common_start_continuous_measurement
int16_t sfm_common_start_continuous_measurement(SfmConfig *sfm_config, SfmCmdStartContinuousMeasurement measurement_cmd)
Definition: driver_SFM3019.cpp:332
SensorSFM3019::sensirion_i2c_write_cmd
int16_t sensirion_i2c_write_cmd(uint8_t address, uint16_t command)
Definition: driver_SFM3019.cpp:173
CRC8_INIT
#define CRC8_INIT
Definition: driver_SFM3019.cpp:59
SensorSFM3019::sensirion_i2c_general_call_reset
int16_t sensirion_i2c_general_call_reset(void)
Definition: driver_SFM3019.cpp:104
SfmConfig::flow_offset
int16_t flow_offset
Definition: driver_SFM3019.h:15
SENSIRION_WORD_SIZE
#define SENSIRION_WORD_SIZE
Definition: driver_SFM3019.cpp:63
SfmConfig::i2c_address
uint8_t i2c_address
Definition: driver_SFM3019.h:13
SensorSFM3019::sensirion_i2c_write_cmd_with_args
int16_t sensirion_i2c_write_cmd_with_args(uint8_t address, uint16_t command, const uint16_t *data_words, uint16_t num_words)
Definition: driver_SFM3019.cpp:180
SensorSFM3019::sensirion_i2c_read
int8_t sensirion_i2c_read(uint8_t address, uint8_t *data, uint16_t count)
Definition: driver_SFM3019.cpp:216
SensorSFM3019::sfm_common_read_product_identifier
int16_t sfm_common_read_product_identifier(uint8_t i2c_address, uint32_t *product_number, uint8_t(*serial_number)[8])
Definition: driver_SFM3019.cpp:259
SensorSFM3019::sfm_common_probe
int16_t sfm_common_probe(uint8_t i2c_address)
Definition: driver_SFM3019.cpp:253
SensorSFM3019::sensirion_fill_cmd_send_buf
uint16_t sensirion_fill_cmd_send_buf(uint8_t *buf, uint16_t cmd, const uint16_t *args, uint8_t num_args)
Definition: driver_SFM3019.cpp:110
SENSIRION_MAX_BUFFER_WORDS
#define SENSIRION_MAX_BUFFER_WORDS
Definition: driver_SFM3019.cpp:65
SensorSFM3019::sfm_common_read_scale_factor_offset_and_unit
int16_t sfm_common_read_scale_factor_offset_and_unit(const SfmConfig *sfm_config, SfmCmdStartContinuousMeasurement measurement_cmd, int16_t *flow_scale, int16_t *flow_offset, uint16_t *unit)
Definition: driver_SFM3019.cpp:284
DriverContext::hwi
HW * hwi
Definition: DriverContext.h:6
driver_SFM3019.h
SENSIRION_COMMAND_SIZE
#define SENSIRION_COMMAND_SIZE
Definition: driver_SFM3019.cpp:62
SensorSFM3019::sfm3019_probe
int16_t sfm3019_probe(void)
Definition: driver_SFM3019.cpp:374
ARRAY_SIZE
#define ARRAY_SIZE(x)
Definition: driver_SFM3019.cpp:55
HW_V4
Driver for the Nuclear Instruments V4 Hardware Board.
Definition: fw_board_ni_v4.h:23
SFM3019_SOFT_RESET_TIME_US
#define SFM3019_SOFT_RESET_TIME_US
Definition: driver_SFM3019.cpp:20
t_i2cdevices
t_i2cdevices
Definition: generic_definitions.h:36
SfmConfig
Definition: driver_SFM3019.h:12
SensorSFM3019::hwi
HW * hwi
Definition: driver_SFM3019.h:48
SensorSFM3019::sfm3019_create
SfmConfig sfm3019_create(void)
Definition: driver_SFM3019.cpp:378
SensorSFM3019::sensirion_i2c_read_words
int16_t sensirion_i2c_read_words(uint8_t address, uint16_t *data_words, uint16_t num_words)
Definition: driver_SFM3019.cpp:157
CRC8_POLYNOMIAL
#define CRC8_POLYNOMIAL
Definition: driver_SFM3019.cpp:58
DBG_KERNEL
@ DBG_KERNEL
Definition: DebugIface.h:25
DebugIfaceClass::DbgPrint
void DbgPrint(dbg_source source, verbose_level vl, String s)
Print a message on the debug console.
Definition: DebugIface.cpp:40
SensorSFM3019::dbg
DebugIfaceClass * dbg
Definition: driver_SFM3019.h:49
SfmConfig::flow_scale
int16_t flow_scale
Definition: driver_SFM3019.h:14
SensorSFM3019::sensirion_i2c_read_cmd
int16_t sensirion_i2c_read_cmd(uint8_t address, uint16_t cmd, uint16_t *data_words, uint16_t num_words)
Definition: driver_SFM3019.cpp:207
DebugIfaceClass
Debug class: this class print debug message.
Definition: DebugIface.h:38
DBG_WARNING
@ DBG_WARNING
Definition: DebugIface.h:20
SfmCmdStartContinuousMeasurement
SfmCmdStartContinuousMeasurement
Definition: driver_SFM3019.h:19
SensorSFM3019::sensirion_sleep_usec
void sensirion_sleep_usec(uint32_t useconds)
Definition: driver_SFM3019.cpp:244
SFM_CMD_READ_SCALE_FACTOR_OFFSET_AND_FLOW_UNIT
#define SFM_CMD_READ_SCALE_FACTOR_OFFSET_AND_FLOW_UNIT
Definition: driver_SFM3019.cpp:70
be16_to_cpu
#define be16_to_cpu(s)
Definition: driver_SFM3019.cpp:35
SensorSFM3019::sfm3019
SfmConfig sfm3019
Definition: driver_SFM3019.h:361
STATUS_OK
#define STATUS_OK
Definition: driver_SFM3019.cpp:24
IIC_GENERAL_CALL_SENSIRION
@ IIC_GENERAL_CALL_SENSIRION
Definition: generic_definitions.h:49
SensorSFM3019::sensirion_i2c_delayed_read_cmd
int16_t sensirion_i2c_delayed_read_cmd(uint8_t address, uint16_t cmd, uint32_t delay_us, uint16_t *data_words, uint16_t num_words)
Definition: driver_SFM3019.cpp:190
SensorSFM3019::sfm_common_read_measurement_raw
int16_t sfm_common_read_measurement_raw(const SfmConfig *sfm_config, int16_t *flow_raw, int16_t *temperature_raw, uint16_t *status)
Definition: driver_SFM3019.cpp:345