MAX30001G 1.0.1 Arduino library for MAX30001G ECG and BIOZ AFE

max30001g_globals.h
Go to the documentation of this file.
1 #ifndef MAX30001G_GLOBALS_H
2 #define MAX30001G_GLOBALS_H
3
4 #include <stdint.h>
5 #include "RingBuffer.h"
6 #include "max30001g_defs.h"
7 #include "max30001g_typedefs.h"
8 #include "max30001g_regs_typedefs.h"
9
10 // Interrupt Flags
11 extern volatile bool ecg_available;
12 extern volatile bool bioz_available;
13 extern volatile bool rtor_available;
14
15
16 // Data Buffers
17 extern RingBuffer<float, 128> ECG_data;
18 extern RingBuffer<float, 128> BIOZ_data;
19 extern RingBuffer<float, 16> RTOR_data;
20 extern RingBuffer<ImpedanceSpectrum, 4> BIOZ_spectrum;
21
22 extern int ecg_counter;
23 extern int bioz_counter;
24 extern int rtor_counter;
25 extern float rr_interval;
26
27 // Impedance Measurement Data
28 extern float impedance_magnitude[MAX30001_BIOZ_NUM_FREQUENCIES];
29 extern float impedance_phase[MAX30001_BIOZ_NUM_FREQUENCIES];
30 extern float impedance_frequency[MAX30001_BIOZ_NUM_FREQUENCIES];
31
32 // Error & Status Flags
33 extern volatile bool ecg_lead_off;
34 extern volatile bool ecg_fast_recovery_occurred;
35 extern volatile bool ecg_overflow_occurred;
36 extern volatile bool bioz_cgm_occurred;
37 extern volatile bool bioz_undervoltage_occurred;
38 extern volatile bool bioz_overvoltage_occurred;
39 extern volatile bool bioz_overflow_occurred;
40 extern volatile bool leads_on_detected;
41 extern volatile bool pll_unlocked_occurred;
42
43 extern volatile bool afe_irq_pending;
44 extern volatile bool afe_irq1_pending;
45 extern volatile bool afe_irq2_pending;
46
47 extern bool over_voltage_detected;
48 extern bool under_voltage_detected;
49 extern bool valid_data_detected;
50 extern bool EOF_detected;
51
52 // MAX30001 Timing and Measurement Settings
53 extern float ECG_samplingRate;
54 extern float BIOZ_samplingRate;
55 extern float RtoR_resolution;
56 extern float RtoR_delay;
57 extern float CAL_resolution;
58 extern float CAL_fcal;
59 extern float fmstr;
60 extern float tres;
61 extern float ECG_progression;
62 extern float ECG_hpf;
63 extern float ECG_lpf;
64 extern float ECG_latency;
65 extern int ECG_gain;
66 extern int BIOZ_gain;
67 extern int BIOZ_cgmag;
68 extern uint32_t BIOZ_cmres;
69 extern uint16_t RBIASV_res;
70 extern float BIOZ_frequency;
71 extern float BIOZ_phase;
72 extern float BIOZ_ahpf; // [Hz] BIOZ analog high pass filter
73 extern float BIOZ_dlpf; // [Hz] BIOZ digital low pass filter
74 extern float BIOZ_dhpf; // [Hz] BIOZ digital high pass filter
75 extern float BIOZ_test_rnom; // [kOhm] BIOZ test resistor nominal value
76 extern float BIOZ_test_rmod; // [kOhm] BIOZ test resistor modulation value
77 extern float BIOZ_test_frequency; // [Hz] BIOZ test frequency for modulation
78 extern int32_t V_ref;
79 extern int32_t V_AVDD;
80 extern float RCAL_freq;
81
82 // MAX30001 Configuration and Status Registers
83 extern max30001_status_reg_t status;
84 extern max30001_en_int_reg_t en_int1;
85 extern max30001_en_int_reg_t en_int2;
86 extern max30001_mngr_int_reg_t mngr_int;
87 extern max30001_mngr_dyn_reg_t mngr_dyn;
88 extern max30001_info_reg_t info;
89 extern max30001_cnfg_gen_reg_t cnfg_gen;
90 extern max30001_cnfg_cal_reg_t cnfg_cal;
91 extern max30001_cnfg_emux_reg_t cnfg_emux;
92 extern max30001_cnfg_ecg_reg_t cnfg_ecg;
93 extern max30001_cnfg_bmux_reg_t cnfg_bmux;
94 extern max30001_cnfg_bioz_reg_t cnfg_bioz;
95 extern max30001_cnfg_bioz_lc_reg_t cnfg_bioz_lc;
96 extern max30001_cnfg_rtor1_reg_t cnfg_rtor1;
97 extern max30001_cnfg_rtor2_reg_t cnfg_rtor2;
98
99 #endif // MAX30001G_GLOBALS_H
RingBuffer.h
RingBuffer
Definition: RingBuffer.h:53
max30001g_defs.h
MAX30001_BIOZ_NUM_FREQUENCIES
#define MAX30001_BIOZ_NUM_FREQUENCIES
Definition: max30001g_defs.h:11
valid_data_detected
bool valid_data_detected
Definition: max30001g_globals.cpp:43
RBIASV_res
uint16_t RBIASV_res
Definition: max30001g_globals.cpp:65
V_AVDD
int32_t V_AVDD
Definition: max30001g_globals.cpp:75
RtoR_resolution
float RtoR_resolution
Definition: max30001g_globals.cpp:51
info
max30001_info_reg_t info
Definition: max30001g_globals.cpp:85
ECG_samplingRate
float ECG_samplingRate
Definition: max30001g_globals.cpp:49
cnfg_cal
max30001_cnfg_cal_reg_t cnfg_cal
Definition: max30001g_globals.cpp:87
rr_interval
float rr_interval
Definition: max30001g_globals.cpp:21
BIOZ_dlpf
float BIOZ_dlpf
Definition: max30001g_globals.cpp:70
ECG_latency
float ECG_latency
Definition: max30001g_globals.cpp:60
cnfg_ecg
max30001_cnfg_ecg_reg_t cnfg_ecg
Definition: max30001g_globals.cpp:89
rtor_counter
int rtor_counter
Definition: max30001g_globals.cpp:20
BIOZ_spectrum
RingBuffer< ImpedanceSpectrum, 4 > BIOZ_spectrum
Definition: max30001g_globals.cpp:16
cnfg_rtor1
max30001_cnfg_rtor1_reg_t cnfg_rtor1
Definition: max30001g_globals.cpp:93
ECG_lpf
float ECG_lpf
Definition: max30001g_globals.cpp:59
en_int2
max30001_en_int_reg_t en_int2
Definition: max30001g_globals.cpp:82
ECG_gain
int ECG_gain
Definition: max30001g_globals.cpp:61
BIOZ_dhpf
float BIOZ_dhpf
Definition: max30001g_globals.cpp:69
tres
float tres
Definition: max30001g_globals.cpp:56
ECG_progression
float ECG_progression
Definition: max30001g_globals.cpp:57
afe_irq1_pending
volatile bool afe_irq1_pending
Definition: max30001g_globals.cpp:38
impedance_magnitude
float impedance_magnitude[MAX30001_BIOZ_NUM_FREQUENCIES]
Definition: max30001g_globals.cpp:23
rtor_available
volatile bool rtor_available
Definition: max30001g_globals.cpp:11
bioz_overvoltage_occurred
volatile bool bioz_overvoltage_occurred
Definition: max30001g_globals.cpp:32
bioz_cgm_occurred
volatile bool bioz_cgm_occurred
Definition: max30001g_globals.cpp:30
ecg_available
volatile bool ecg_available
Definition: max30001g_globals.cpp:9
fmstr
float fmstr
Definition: max30001g_globals.cpp:55
V_ref
int32_t V_ref
Definition: max30001g_globals.cpp:74
afe_irq2_pending
volatile bool afe_irq2_pending
Definition: max30001g_globals.cpp:39
EOF_detected
bool EOF_detected
Definition: max30001g_globals.cpp:44
cnfg_bioz_lc
max30001_cnfg_bioz_lc_reg_t cnfg_bioz_lc
Definition: max30001g_globals.cpp:92
cnfg_rtor2
max30001_cnfg_rtor2_reg_t cnfg_rtor2
Definition: max30001g_globals.cpp:94
afe_irq_pending
volatile bool afe_irq_pending
Definition: max30001g_globals.cpp:37
cnfg_emux
max30001_cnfg_emux_reg_t cnfg_emux
Definition: max30001g_globals.cpp:88
BIOZ_test_rmod
float BIOZ_test_rmod
Definition: max30001g_globals.cpp:72
BIOZ_frequency
float BIOZ_frequency
Definition: max30001g_globals.cpp:66
mngr_int
max30001_mngr_int_reg_t mngr_int
Definition: max30001g_globals.cpp:83
ecg_overflow_occurred
volatile bool ecg_overflow_occurred
Definition: max30001g_globals.cpp:29
leads_on_detected
volatile bool leads_on_detected
Definition: max30001g_globals.cpp:34
bioz_available
volatile bool bioz_available
Definition: max30001g_globals.cpp:10
BIOZ_gain
int BIOZ_gain
Definition: max30001g_globals.cpp:62
status
max30001_status_reg_t status
Definition: max30001g_globals.cpp:80
ECG_hpf
float ECG_hpf
Definition: max30001g_globals.cpp:58
RTOR_data
RingBuffer< float, 16 > RTOR_data
Definition: max30001g_globals.cpp:15
BIOZ_test_rnom
float BIOZ_test_rnom
Definition: max30001g_globals.cpp:71
ecg_counter
int ecg_counter
Definition: max30001g_globals.cpp:18
cnfg_bmux
max30001_cnfg_bmux_reg_t cnfg_bmux
Definition: max30001g_globals.cpp:90
BIOZ_cmres
uint32_t BIOZ_cmres
Definition: max30001g_globals.cpp:64
under_voltage_detected
bool under_voltage_detected
Definition: max30001g_globals.cpp:42
BIOZ_cgmag
int BIOZ_cgmag
Definition: max30001g_globals.cpp:63
CAL_fcal
float CAL_fcal
Definition: max30001g_globals.cpp:54
BIOZ_ahpf
float BIOZ_ahpf
Definition: max30001g_globals.cpp:68
cnfg_gen
max30001_cnfg_gen_reg_t cnfg_gen
Definition: max30001g_globals.cpp:86
BIOZ_phase
float BIOZ_phase
Definition: max30001g_globals.cpp:67
pll_unlocked_occurred
volatile bool pll_unlocked_occurred
Definition: max30001g_globals.cpp:35
RCAL_freq
float RCAL_freq
Definition: max30001g_globals.cpp:76
en_int1
max30001_en_int_reg_t en_int1
Definition: max30001g_globals.cpp:81
impedance_phase
float impedance_phase[MAX30001_BIOZ_NUM_FREQUENCIES]
Definition: max30001g_globals.cpp:24
bioz_counter
int bioz_counter
Definition: max30001g_globals.cpp:19
BIOZ_test_frequency
float BIOZ_test_frequency
Definition: max30001g_globals.cpp:73
ecg_lead_off
volatile bool ecg_lead_off
Definition: max30001g_globals.cpp:27
bioz_undervoltage_occurred
volatile bool bioz_undervoltage_occurred
Definition: max30001g_globals.cpp:31
impedance_frequency
float impedance_frequency[MAX30001_BIOZ_NUM_FREQUENCIES]
Definition: max30001g_globals.cpp:25
mngr_dyn
max30001_mngr_dyn_reg_t mngr_dyn
Definition: max30001g_globals.cpp:84
over_voltage_detected
bool over_voltage_detected
Definition: max30001g_globals.cpp:41
CAL_resolution
float CAL_resolution
Definition: max30001g_globals.cpp:53
BIOZ_data
RingBuffer< float, 128 > BIOZ_data
Definition: max30001g_globals.cpp:14
cnfg_bioz
max30001_cnfg_bioz_reg_t cnfg_bioz
Definition: max30001g_globals.cpp:91
ECG_data
RingBuffer< float, 128 > ECG_data
Definition: max30001g_globals.cpp:13
RtoR_delay
float RtoR_delay
Definition: max30001g_globals.cpp:52
bioz_overflow_occurred
volatile bool bioz_overflow_occurred
Definition: max30001g_globals.cpp:33
BIOZ_samplingRate
float BIOZ_samplingRate
Definition: max30001g_globals.cpp:50
ecg_fast_recovery_occurred
volatile bool ecg_fast_recovery_occurred
Definition: max30001g_globals.cpp:28
max30001g_regs_typedefs.h
max30001g_typedefs.h
max30001_cnfg_bioz_lc_reg_t
CNFG_BIOZ_LC (0x1A) page 57.
Definition: max30001g_regs_typedefs.h:300
max30001_cnfg_bioz_reg_t
CNFG_BIOZ (0x18) page 54.
Definition: max30001g_regs_typedefs.h:275
max30001_cnfg_bmux_reg_t
CNFG_BMUX (0x17) page 52.
Definition: max30001g_regs_typedefs.h:248
max30001_cnfg_cal_reg_t
CNFG_CAL (0x12) page 49.
Definition: max30001g_regs_typedefs.h:184
max30001_cnfg_ecg_reg
CNFG_ECG (0x15) page 51.
Definition: max30001g_regs_typedefs.h:227
max30001_cnfg_emux_reg
CNFG_EMUX (0x14) page 50.
Definition: max30001g_regs_typedefs.h:206
max30001_cnfg_gen_reg_t
CNFG_GEN (0x10) page 47.
Definition: max30001g_regs_typedefs.h:155
max30001_cnfg_rtor1_reg_t
CNFG_RTOR1 (0x1D) page 59.
Definition: max30001g_regs_typedefs.h:323
max30001_cnfg_rtor2_reg_t
CNFG_RTOR2 (0x1E) page 59.
Definition: max30001g_regs_typedefs.h:344
max30001_en_int_reg_t
EN_INT (0x02) and (0x03) page 43 we can attach two interrupt lines to functions of the MAX30001 multi...
Definition: max30001g_regs_typedefs.h:59
max30001_info_reg
INFO (0x0F) page 42.
Definition: max30001g_regs_typedefs.h:132
max30001_mngr_dyn_reg_t
MNGR_DYN (0x05) page 45.
Definition: max30001g_regs_typedefs.h:113
max30001_mngr_int_reg_t
MNGR_INT (0x04) page 44.
Definition: max30001g_regs_typedefs.h:88
max30001_status_reg_t
STATUS (0x01) page 42.
Definition: max30001g_regs_typedefs.h:11