MAX30001G 1.3.0 Arduino library for MAX30001G ECG and BIOZ AFE

max30001g_typedefs.h
Go to the documentation of this file.
1 /******************************************************************************************************/
2 /* Structures */
3 /******************************************************************************************************/
4
5 #ifndef MAX30001G_TYPEDEFS_H
6 #define MAX30001G_TYPEDEFS_H
7
8 #include <stdint.h>
9 #include "max30001g_defs.h"
10
16 struct ImpedanceModel {
17 float magnitude;
18 float phase;
19 };
20
25 struct ImpedanceSpectrum {
26 float frequency[MAX30001_BIOZ_NUM_FREQUENCIES];
27 float magnitude[MAX30001_BIOZ_NUM_FREQUENCIES];
28 float phase[MAX30001_BIOZ_NUM_FREQUENCIES];
29 };
30
39 struct HealthCheckResult {
40 bool spi_ok;
41 uint32_t info_reg;
42 uint32_t status_reg;
43 bool pll_unlocked;
44 bool fault_present;
45 };
46
52 enum BIOZScanPhaseRange : uint8_t {
53 BIOZ_SCAN_PHASE_FULL = 0,
54 BIOZ_SCAN_PHASE_REDUCED
55 };
56
77 struct BIOZScanConfig {
78 uint8_t avg;
79 bool fast;
80 bool fourleads;
81 bool use_internal_resistor;
82 uint16_t internal_resistor_ohm;
83 uint8_t max_retries;
84 float low_target_fraction;
85 float high_target_fraction;
86 float target_fraction;
87 uint8_t outlier_min_samples;
88 float outlier_sigma;
89 uint16_t timeout_margin_ms;
90 uint8_t freq_start_index;
91 uint8_t freq_end_index;
92 BIOZScanPhaseRange phase_range;
93 uint8_t internal_bist_ahpf;
94 int32_t initial_current_nA;
95 uint8_t settle_samples;
96 uint8_t current_change_settle_samples;
97
98 BIOZScanConfig()
99 : avg(2),
100 fast(false),
101 fourleads(false),
102 use_internal_resistor(false),
103 internal_resistor_ohm(1000),
104 max_retries(4),
105 low_target_fraction(0.10f),
106 high_target_fraction(0.90f),
107 target_fraction(0.60f),
108 outlier_min_samples(5),
109 outlier_sigma(2.5f),
110 timeout_margin_ms(50),
111 freq_start_index(0),
112 freq_end_index(7),
113 phase_range(BIOZ_SCAN_PHASE_FULL),
114 internal_bist_ahpf(255U),
115 initial_current_nA(8000),
116 settle_samples(24),
117 current_change_settle_samples(32) {}
118 };
119
125 struct ConfigSnapshot {
126 bool valid;
127 uint32_t en_int1;
128 uint32_t en_int2;
129 uint32_t mngr_int;
130 uint32_t mngr_dyn;
131 uint32_t cnfg_gen;
132 uint32_t cnfg_cal;
133 uint32_t cnfg_emux;
134 uint32_t cnfg_ecg;
135 uint32_t cnfg_bmux;
136 uint32_t cnfg_bioz;
137 uint32_t cnfg_bioz_lc;
138 uint32_t cnfg_rtor1;
139 uint32_t cnfg_rtor2;
140 };
141
142 #endif // MAX30001G_TYPEDEFS_H
max30001g_defs.h
MAX30001_BIOZ_NUM_FREQUENCIES
#define MAX30001_BIOZ_NUM_FREQUENCIES
Definition: max30001g_defs.h:11
BIOZScanPhaseRange
BIOZScanPhaseRange
BIOZ scan phase-density selection.
Definition: max30001g_typedefs.h:52
BIOZ_SCAN_PHASE_FULL
@ BIOZ_SCAN_PHASE_FULL
Definition: max30001g_typedefs.h:53
BIOZ_SCAN_PHASE_REDUCED
@ BIOZ_SCAN_PHASE_REDUCED
Definition: max30001g_typedefs.h:54
BIOZScanConfig
BIOZScanConfig configuration structure fields:
Definition: max30001g_typedefs.h:77
BIOZScanConfig::BIOZScanConfig
BIOZScanConfig()
Definition: max30001g_typedefs.h:98
BIOZScanConfig::use_internal_resistor
bool use_internal_resistor
Definition: max30001g_typedefs.h:81
BIOZScanConfig::internal_bist_ahpf
uint8_t internal_bist_ahpf
Definition: max30001g_typedefs.h:93
BIOZScanConfig::freq_end_index
uint8_t freq_end_index
Definition: max30001g_typedefs.h:91
BIOZScanConfig::fourleads
bool fourleads
Definition: max30001g_typedefs.h:80
BIOZScanConfig::initial_current_nA
int32_t initial_current_nA
Definition: max30001g_typedefs.h:94
BIOZScanConfig::high_target_fraction
float high_target_fraction
Definition: max30001g_typedefs.h:85
BIOZScanConfig::phase_range
BIOZScanPhaseRange phase_range
Definition: max30001g_typedefs.h:92
BIOZScanConfig::settle_samples
uint8_t settle_samples
Definition: max30001g_typedefs.h:95
BIOZScanConfig::target_fraction
float target_fraction
Definition: max30001g_typedefs.h:86
BIOZScanConfig::freq_start_index
uint8_t freq_start_index
Definition: max30001g_typedefs.h:90
BIOZScanConfig::low_target_fraction
float low_target_fraction
Definition: max30001g_typedefs.h:84
BIOZScanConfig::outlier_sigma
float outlier_sigma
Definition: max30001g_typedefs.h:88
BIOZScanConfig::outlier_min_samples
uint8_t outlier_min_samples
Definition: max30001g_typedefs.h:87
BIOZScanConfig::avg
uint8_t avg
Definition: max30001g_typedefs.h:78
BIOZScanConfig::internal_resistor_ohm
uint16_t internal_resistor_ohm
Definition: max30001g_typedefs.h:82
BIOZScanConfig::timeout_margin_ms
uint16_t timeout_margin_ms
Definition: max30001g_typedefs.h:89
BIOZScanConfig::fast
bool fast
Definition: max30001g_typedefs.h:79
BIOZScanConfig::max_retries
uint8_t max_retries
Definition: max30001g_typedefs.h:83
BIOZScanConfig::current_change_settle_samples
uint8_t current_change_settle_samples
Definition: max30001g_typedefs.h:96
ConfigSnapshot
ConfigSnapshot structure for storing/restoring MAX30001G register configurations.
Definition: max30001g_typedefs.h:125
ConfigSnapshot::cnfg_rtor2
uint32_t cnfg_rtor2
Definition: max30001g_typedefs.h:139
ConfigSnapshot::en_int2
uint32_t en_int2
Definition: max30001g_typedefs.h:128
ConfigSnapshot::cnfg_bioz
uint32_t cnfg_bioz
Definition: max30001g_typedefs.h:136
ConfigSnapshot::en_int1
uint32_t en_int1
Definition: max30001g_typedefs.h:127
ConfigSnapshot::cnfg_gen
uint32_t cnfg_gen
Definition: max30001g_typedefs.h:131
ConfigSnapshot::cnfg_emux
uint32_t cnfg_emux
Definition: max30001g_typedefs.h:133
ConfigSnapshot::mngr_dyn
uint32_t mngr_dyn
Definition: max30001g_typedefs.h:130
ConfigSnapshot::mngr_int
uint32_t mngr_int
Definition: max30001g_typedefs.h:129
ConfigSnapshot::cnfg_ecg
uint32_t cnfg_ecg
Definition: max30001g_typedefs.h:134
ConfigSnapshot::cnfg_bmux
uint32_t cnfg_bmux
Definition: max30001g_typedefs.h:135
ConfigSnapshot::cnfg_cal
uint32_t cnfg_cal
Definition: max30001g_typedefs.h:132
ConfigSnapshot::cnfg_bioz_lc
uint32_t cnfg_bioz_lc
Definition: max30001g_typedefs.h:137
ConfigSnapshot::valid
bool valid
Definition: max30001g_typedefs.h:126
ConfigSnapshot::cnfg_rtor1
uint32_t cnfg_rtor1
Definition: max30001g_typedefs.h:138
HealthCheckResult
HealthCheckResult structure for storing health check results.
Definition: max30001g_typedefs.h:39
HealthCheckResult::spi_ok
bool spi_ok
Definition: max30001g_typedefs.h:40
HealthCheckResult::pll_unlocked
bool pll_unlocked
Definition: max30001g_typedefs.h:43
HealthCheckResult::info_reg
uint32_t info_reg
Definition: max30001g_typedefs.h:41
HealthCheckResult::status_reg
uint32_t status_reg
Definition: max30001g_typedefs.h:42
HealthCheckResult::fault_present
bool fault_present
Definition: max30001g_typedefs.h:44
ImpedanceModel
ImpedanceModel structure for storing impedance measurement results.
Definition: max30001g_typedefs.h:16
ImpedanceModel::phase
float phase
Definition: max30001g_typedefs.h:18
ImpedanceModel::magnitude
float magnitude
Definition: max30001g_typedefs.h:17
ImpedanceSpectrum
ImpedanceSpectrum structure for storing one full BIOZ sweep.
Definition: max30001g_typedefs.h:25
ImpedanceSpectrum::magnitude
float magnitude[MAX30001_BIOZ_NUM_FREQUENCIES]
Definition: max30001g_typedefs.h:27
ImpedanceSpectrum::phase
float phase[MAX30001_BIOZ_NUM_FREQUENCIES]
Definition: max30001g_typedefs.h:28
ImpedanceSpectrum::frequency
float frequency[MAX30001_BIOZ_NUM_FREQUENCIES]
Definition: max30001g_typedefs.h:26