MAX30001G 1.0.2 Arduino library for MAX30001G ECG and BIOZ AFE

max30001g_defs.h
Go to the documentation of this file.
1 /******************************************************************************************************/
2 /* MAX30001G */
3 /******************************************************************************************************/
4 #ifndef MAX30001_DEFS_H
5 #define MAX30001_DEFS_H
6
7 // Define SPI speed
8 #define MAX30001_SPI_SPEED 1000000
9
10 // Number of available BIOZ modulation frequencies and phase offsets
11 #define MAX30001_BIOZ_NUM_FREQUENCIES 11
12 #define MAX30001_BIOZ_NUM_PHASES 16
13
14 // MAX30001 Register definitions
15 // Table 12
17 #define MAX30001_NO_OP 0x00 // No operation R/W
18 #define MAX30001_STATUS 0x01 // Status register R
19 #define MAX30001_EN_INT1 0x02 // INT B output R/W
20 #define MAX30001_EN_INT2 0x03 // INT2B output R/W
21 #define MAX30001_MNGR_INT 0x04 // Interrupt management R/W
22 #define MAX30001_MNGR_DYN 0x05 // Dynamic modes management R/W
23 #define MAX30001_SW_RST 0x08 // Software reset W
24 #define MAX30001_SYNCH 0x09 // Synchronize, begins new operations W
25 #define MAX30001_FIFO_RST 0x0A // FIFO reset W
26 #define MAX30001_INFO 0x0F // Information on MAX30001 R
27 #define MAX30001_CNFG_GEN 0x10 // General settings R/W
28 #define MAX30001_CNFG_CAL 0x12 // Internal calibration settings R/W
29 #define MAX30001_CNFG_EMUX 0x14 // Input multiplexer for ECG R/W
30 #define MAX30001_CNFG_ECG 0x15 // ECG channel R/W
31 #define MAX30001_CNFG_BMUX 0x17 // Input multiplexr for BIOZ R/W
32 #define MAX30001_CNFG_BIOZ 0x18 // BIOZ channel R/W
33 #define MAX30001_CNFG_BIOZ_LC 0x1A // BIOZ low current ranges R/W
34 #define MAX30001_CNFG_RTOR1 0x1D // R to R heart rate detection R/W
35 #define MAX30001_CNFG_RTOR2 0x1E // second part of Register R/W
36
37 // FIFO is a circular memory of 32*24 bits
38 // An interrupt is triggered when threshold for number of samples is reached
39 // An overflow is triggered if the write pointer reaches the read pointer
40 // FIFO Data:
41 // ECG[ 23: 6] two s complement,
42 // ECG[ 5: 3] Tag: Valid, Fast, Valid EOF, Fast EOF, Empty, Overflow
43 // BIOZ[23: 4] two s complement
44 // BIOZ[ 2: 0] Tag,Valid, Over/Under range, Valid EOF, Over/Under EOF, Empty, Overflow
45 // RTOR[23:10] two s complement
46 #define MAX30001_ECG_FIFO_BURST 0x20 // FIFO address to read multiple values sequentially (burst mode)
47 #define MAX30001_ECG_FIFO 0x21 // FIFO address to read each element individually
48 #define MAX30001_BIOZ_FIFO_BURST 0x22 // FIFO
49 #define MAX30001_BIOZ_FIFO 0x23 // FIFO
50 #define MAX30001_RTOR 0x25 // Result of internal R to R detection
51 #define MAX30001_NO_OP2 0x7F // No operation (alternate no-op address) R/W
52
53 // MAX30001 Commands
54 #define MAX30001_WRITEREG 0x00
55 #define MAX30001_READREG 0x01
56
57 //
58 #define MAX30001_RTOR_INTR_MASK (1UL << 10) // RRINT bit in STATUS / EN_INT
59
60 // MAX30001 Registers
62 // MAX30001 STATUS (0x01) Register Bit Masks
63 #define MAX30001_STATUS_EINT (1UL << 23)
64 #define MAX30001_STATUS_EOVF (1UL << 22)
65 #define MAX30001_STATUS_FSTINT (1UL << 21)
66 #define MAX30001_STATUS_DCLOFFINT (1UL << 20)
67 #define MAX30001_STATUS_BINT (1UL << 19)
68 #define MAX30001_STATUS_BOVF (1UL << 18)
69 #define MAX30001_STATUS_BOVER (1UL << 17)
70 #define MAX30001_STATUS_BUNDR (1UL << 16)
71 #define MAX30001_STATUS_BCGMON (1UL << 15)
72 #define MAX30001_STATUS_LONINT (1UL << 11)
73 #define MAX30001_STATUS_RRINT (1UL << 10)
74 #define MAX30001_STATUS_SAMP (1UL << 9)
75 #define MAX30001_STATUS_PLLINT (1UL << 8)
76 #define MAX30001_STATUS_BCGMP (1UL << 5)
77 #define MAX30001_STATUS_BCGMN (1UL << 4)
78 #define MAX30001_STATUS_LDOFF_PH (1UL << 3)
79 #define MAX30001_STATUS_LDOFF_PL (1UL << 2)
80 #define MAX30001_STATUS_LDOFF_NH (1UL << 1)
81 #define MAX30001_STATUS_LDOFF_NL (1UL << 0)
82
83 // MAX30001 EN_INT (0x02) and EN_INT2 (0x03) Register Bit Masks
84 #define MAX30001_EN_INT_EINT (1UL << 23)
85 #define MAX30001_EN_INT_EOVF (1UL << 22)
86 #define MAX30001_EN_INT_FSTINT (1UL << 21)
87 #define MAX30001_EN_INT_DCLOFFINT (1UL << 20)
88 #define MAX30001_EN_INT_BINT (1UL << 19)
89 #define MAX30001_EN_INT_BOVF (1UL << 18)
90 #define MAX30001_EN_INT_BOVER (1UL << 17)
91 #define MAX30001_EN_INT_BUNDR (1UL << 16)
92 #define MAX30001_EN_INT_BCGMON (1UL << 15)
93 #define MAX30001_EN_INT_LONINT (1UL << 11)
94 #define MAX30001_EN_INT_RRINT (1UL << 10)
95 #define MAX30001_EN_INT_SAMP (1UL << 9)
96 #define MAX30001_EN_INT_PLLINT (1UL << 8)
97 #define MAX30001_EN_INT_INTB_TYPE_MASK (0x3UL << 0)
98
99 // Backward-compatible alias kept for existing code.
100 #define MAX30001_EN_INT_BUNDER MAX30001_EN_INT_BUNDR
101
102 #endif