software:firmware
MakAir Firmware
mass_flow_meter.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <Arduino.h>
17 bool MFM_init(void);
18 
25 int32_t MFM_read_milliliters(bool reset_after_read);
26 
33 int32_t MFM_expi_read_milliliters(bool reset_after_read);
34 
36 void MFM_reset(void);
37 
48 int8_t MFM_calibrateZero(void);
49 
50 #define MFM_CALIBRATION_OK 0
51 #define MFM_CALIBRATION_IMPOSSIBLE 1
52 #define MFM_CALIBRATION_OUT_OF_RANGE 2
53 
57 int32_t MFM_getOffset(void);
58 
62 int32_t MFM_read_airflow(void);
63 
67 int32_t MFM_expi_read_airflow(void);
68 
74 uint32_t MFM_read_serial_number(void);
75 
81 uint32_t MFM_expi_read_serial_number(void);
82 
83 #define MFM_SFM_3300D_I2C_ADDRESS 0x40
84 #define MFM_HONEYWELL_HAF_I2C_ADDRESS 0x49
85 #define MFM_SDP703_02_I2C_ADDRESS 0x40
86 #define MFM_SFM3019_I2C_ADDRESS 0x2E
87 
88 // exposed for other peripherals sharing I2C bus pause the timer.
89 extern volatile uint16_t MFM_force_release_I2C;
90 #define MFM_FORCE_RELEASE_I2C_TRUE 0xb00b
91 #define MFM_FORCE_RELEASE_I2C_FALSE 0
void MFM_reset(void)
Reset the volume counter.
int32_t MFM_getOffset(void)
Get massflow meter offset.
uint32_t MFM_expi_read_serial_number(void)
Get the serial number of the expiratory flow meter.
int8_t MFM_calibrateZero(void)
Calibrate the zero of the sensor.
int32_t MFM_read_airflow(void)
Read instant air flow.
uint32_t MFM_read_serial_number(void)
Get the serial number of the inspiratory flow meter.
int32_t MFM_expi_read_airflow(void)
Read instant air flow.
volatile uint16_t MFM_force_release_I2C
int32_t MFM_read_milliliters(bool reset_after_read)
Get the number of milliliters since last reset.
int32_t MFM_expi_read_milliliters(bool reset_after_read)
Get the number of milliliters since last reset for expiratory sensor.
bool MFM_init(void)
Initialize Mass Flow Meter.