Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ads1299.h
00001 #ifndef _ADS1299_h 00002 #define _ADS1299_h 00003 00004 #define ADS129X_CMD_WAKEUP 0x02 // Wake-up from standby mode 00005 #define ADS129X_CMD_STANDBY 0x04 // Enter Standby mode 00006 #define ADS129X_CMD_RESET 0x06 // Reset the device 00007 #define ADS129X_CMD_START 0x08 // Start and restart (synchronize) conversions 00008 #define ADS129X_CMD_STOP 0x0A // Stop conversion 00009 #define ADS129X_CMD_RDATAC 0x10 // Enable Read Data Continuous mode (default mode at power-up) 00010 #define ADS129X_CMD_SDATAC 0x11 // Stop Read Data Continuous mode 00011 #define ADS129X_CMD_RDATA 0x12 // Read data by command; supports multiple read back 00012 #define ADS129X_CMD_RREG 0x20 // (also = 00100000) is the first opcode that the address must be added to for RREG communication 00013 #define ADS129X_CMD_WREG 0x40 // 01000000 in binary (Datasheet, pg. 35) 00014 00015 // Register Addresses 00016 #define ADS129X_REG_ID 0x00 // ID Control Register 00017 #define ADS129X_REG_CONFIG1 0x01 // Configuration Register 1 00018 #define ADS129X_REG_CONFIG2 0x02 // Configuration Register 2 00019 #define ADS129X_REG_CONFIG3 0x03 // Configuration Register 3 00020 #define ADS129X_REG_LOFF 0x04 // Lead-Off Control Register 00021 #define ADS129X_REG_CH1SET 0x05 // Individual Channel Settings 1-8 00022 #define ADS129X_REG_CH2SET 0x06 // --- 00023 #define ADS129X_REG_CH3SET 0x07 // --- 00024 #define ADS129X_REG_CH4SET 0x08 // --- 00025 #define ADS129X_REG_CH5SET 0x09 // --- 00026 #define ADS129X_REG_CH6SET 0x0A // --- 00027 #define ADS129X_REG_CH7SET 0x0B // --- 00028 #define ADS129X_REG_CH8SET 0x0C // --- 00029 #define ADS129X_REG_RLD_SENSP 0x0D // Right Leg Drive, positive side 00030 #define ADS129X_REG_RLD_SENSN 0x0E // Right Leg Drive, negative side 00031 #define ADS129X_REG_LOFF_SENSP 0x0F // Lead-Off Detection, positive side 00032 #define ADS129X_REG_LOFF_SENSN 0x10 // Lead-Off Detection, negative side 00033 #define ADS129X_REG_LOFF_FLIP 0x11 // Lead-Off Detection, current direction 00034 #define ADS129X_REG_LOFF_STATP 0x12 // Electrode Status, positive (read-only) 00035 #define ADS129X_REG_LOFF_STATN 0x13 // Electrode Status, negative (read-only) 00036 #define ADS129X_REG_GPIO 0x14 // General-Purpose I/O Register 00037 #define ADS129X_REG_PACE 0x15 // PACE Detect Register 00038 #define ADS129X_REG_RESP 0x16 // Respiration Control Register 00039 #define ADS129X_REG_CONFIG4 0x17 // Configuration Register 4 00040 #define ADS129X_REG_WCT1 0x18 // Wilson Central Terminal and Augmented Lead Control Register 00041 #define ADS129X_REG_WCT2 0x19 // Wilson Central Terminal Control Register 00042 00043 // IDs 00044 #define ADS129X_ID_ADS1294 0x90 00045 #define ADS129X_ID_ADS1296 0x91 00046 #define ADS129X_ID_ADS1298 0x92 00047 #define ADS129X_ID_ADS1294R 0xD0 00048 #define ADS129X_ID_ADS1296R 0xD1 00049 #define ADS129X_ID_ADS1298R 0xD2 00050 00051 // Configuration Register 1 00052 #define ADS129X_BIT_HR 0x7 00053 #define ADS129X_BIT_DAISY_EN 0x6 00054 #define ADS129X_BIT_CLK_EN 0x5 00055 00056 #define ADS129X_BIT_DR2 0x2 00057 #define ADS129X_BIT_DR1 0x1 00058 #define ADS129X_BIT_DR0 0x0 00059 00060 // Configuration Register 2 00061 00062 #define ADS129X_BIT_WCT_CHOP 0x5 00063 #define ADS129X_BIT_INT_TEST 0x4 00064 // always 0 00065 #define ADS129X_BIT_TEST_AMP 0x2 00066 #define ADS129X_BIT_TEST_FREQ1 0x1 00067 #define ADS129X_BIT_TEST_FREQ0 0x0 00068 #define ADS129X_TEST_FREQ_1HZ 0x0 00069 #define ADS129X_TEST_FREQ_2HZ 0x1 00070 #define ADS129X_TEST_FREQ_DC 0x3 00071 00072 // Configuration Register 3 00073 #define ADS129X_BIT_PD_REFBUF 0x7 00074 // always 1 00075 #define ADS129X_BIT_VREF_4V 0x5 00076 #define ADS129X_BIT_RLD_MEAS 0x4 00077 #define ADS129X_BIT_RLDREF_INT 0x3 00078 #define ADS129X_BIT_PD_RLD 0x2 00079 #define ADS129X_BIT_RLD_LOFF_SENS 0x1 00080 #define ADS129X_BIT_RLD_STAT 0x0 00081 00082 // Lead-Off Control Register 00083 #define ADS129X_BIT_COMP_TH2 0x7 00084 #define ADS129X_BIT_COMP_TH1 0x6 00085 #define ADS129X_BIT_COMP_TH0 0x5 00086 #define ADS129X_BIT_VLEAD_OFF_EN 0x4 00087 #define ADS129X_BIT_ILEAD_OFF1 0x3 00088 #define ADS129X_BIT_ILEAD_OFF0 0x2 00089 #define ADS129X_BIT_FLEAD_OFF1 0x1 00090 #define ADS129X_BIT_FLEAD_OFF0 0x0 00091 00092 // Individual Channel Settings 00093 #define ADS129X_BIT_PD 0x7 00094 #define ADS129X_BIT_GAIN2 0x6 00095 #define ADS129X_BIT_GAIN1 0x5 00096 #define ADS129X_BIT_GAIN0 0x4 00097 // always 0 00098 #define ADS129X_BIT_MUX2 0x2 00099 #define ADS129X_BIT_MUX1 0x1 00100 #define ADS129X_BIT_MUX0 0x0 00101 00102 // Channel Select 00103 #define ADS129X_BIT_CH8 0x7 00104 #define ADS129X_BIT_CH7 0x6 00105 #define ADS129X_BIT_CH6 0x5 00106 #define ADS129X_BIT_CH5 0x4 00107 #define ADS129X_BIT_CH4 0x3 00108 #define ADS129X_BIT_CH3 0x2 00109 #define ADS129X_BIT_CH2 0x1 00110 #define ADS129X_BIT_CH1 0x0 00111 00112 // General-Purpose I/O Register 00113 #define ADS129X_BIT_GPIOD4 0x7 00114 #define ADS129X_BIT_GPIOD3 0x6 00115 #define ADS129X_BIT_GPIOD2 0x5 00116 #define ADS129X_BIT_GPIOD1 0x4 00117 #define ADS129X_BIT_GPIOC4 0x3 00118 #define ADS129X_BIT_GPIOC3 0x2 00119 #define ADS129X_BIT_GPIOC2 0x1 00120 #define ADS129X_BIT_GPIOC1 0x0 00121 00122 // PACE Detect Register 00123 00124 #define ADS129X_BIT_PACEE1 0x4 00125 #define ADS129X_BIT_PACEE0 0x3 00126 #define ADS129X_BIT_PACEO1 0x2 00127 #define ADS129X_BIT_PACEO0 0x1 00128 #define ADS129X_BIT_PD_PACE 0x0 00129 00130 // Respiration Control Register 00131 #define ADS129X_BIT_RESP_DEMOD_EN1 0x7 00132 #define ADS129X_BIT_RESP_MOD_EN1 0x6 00133 // always 1 00134 #define ADS129X_BIT_RESP_PH2 0x4 00135 #define ADS129X_BIT_RESP_PH1 0x3 00136 #define ADS129X_BIT_RESP_PH0 0x2 00137 #define ADS129X_BIT_RESP_CTRL1 0x1 00138 #define ADS129X_BIT_RESP_CTRL0 0x0 00139 00140 // Configuration Register 4 00141 #define ADS129X_BIT_RESP_FREQ2 0x7 00142 #define ADS129X_BIT_RESP_FREQ1 0x6 00143 #define ADS129X_BIT_RESP_FREQ0 0x5 00144 // always 0 00145 #define ADS129X_BIT_SINGLE_SHOT 0x3 00146 #define ADS129X_BIT_WCT_TO_RLD 0x2 00147 #define ADS129X_BIT_PD_LOFF_COMP 0x1 00148 // always 0 00149 00150 // Wilson Central Terminal and Augmented Lead Control Register 00151 #define ADS129X_BIT_aVF_CH6 0x7 00152 #define ADS129X_BIT_aVF_CH5 0x6 00153 #define ADS129X_BIT_aVF_CH7 0x5 00154 #define ADS129X_BIT_aVF_CH4 0x4 00155 #define ADS129X_BIT_PD_WCTA 0x3 00156 #define ADS129X_BIT_WCTA2 0x2 00157 #define ADS129X_BIT_WCTA1 0x1 00158 #define ADS129X_BIT_WCTA0 0x0 00159 00160 // Wilson Central Terminal Control Register 00161 #define ADS129X_BIT_PD_WCTC 0x7 00162 #define ADS129X_BIT_PD_WCTB 0x6 00163 #define ADS129X_BIT_WCTB2 0x5 00164 #define ADS129X_BIT_WCTB1 0x4 00165 #define ADS129X_BIT_WCTB0 0x3 00166 #define ADS129X_BIT_WCTC2 0x2 00167 #define ADS129X_BIT_WCTC1 0x1 00168 #define ADS129X_BIT_WCTC0 0x0 00169 00170 // Gain Configuration 00171 #define ADS129X_GAIN_6X 0x0 00172 #define ADS129X_GAIN_1X 0x1 00173 #define ADS129X_GAIN_2X 0x2 00174 #define ADS129X_GAIN_3X 0x3 00175 #define ADS129X_GAIN_4X 0x4 00176 #define ADS129X_GAIN_8X 0x5 00177 #define ADS129X_GAIN_12X 0x6 00178 00179 // Mux Configuration 00180 #define ADS129X_MUX_NORMAL 0x0 // Normal electrode input (default) 00181 #define ADS129X_MUX_SHORT 0x1 // Input shorted (for offset or noise measurements) 00182 #define ADS129X_MUX_RLD_MEAS 0x2 // Used in conjunction with RLD_MEAS bit for RLD measurements 00183 #define ADS129X_MUX_MVDD 0x3 // MVDD for supply measurement 00184 #define ADS129X_MUX_TEMP 0x4 // Temperature sensor 00185 #define ADS129X_MUX_TEST 0x5 // Test signal 00186 #define ADS129X_MUX_RLD_DRP 0x6 // RLD_DRP (positive electrode is the driver) 00187 #define ADS129X_MUX_RLD_DRN 0x7 // RLD_DRN (negative electrode is the driver) 00188 00189 // Sample-rate Configuration 00190 #define ADS129X_SAMPLERATE_1024 0x6 00191 #define ADS129X_SAMPLERATE_512 0x5 00192 #define ADS129X_SAMPLERATE_256 0x4 00193 #define ADS129X_SAMPLERATE_128 0x3 00194 #define ADS129X_SAMPLERATE_64 0x2 00195 #define ADS129X_SAMPLERATE_32 0x1 00196 #define ADS129X_SAMPLERATE_16 0x0 00197 00198 void ADS_INIT(); 00199 void SPI_INIT(); 00200 void WAKEUP(); 00201 void STANDBY(); 00202 void RSET(); 00203 void START(); 00204 void STOP(); 00205 // Data Read Commands 00206 void RDATAC(); 00207 void SDATAC(); 00208 void RDATA(); 00209 void SETUP(); 00210 void Set_IRQ(); 00211 00212 // Register Read/Write Commands 00213 char RREG(char _address); 00214 void RREG(char _address, char _numRegisters, char *_data); //to read multiple consecutive registers (Datasheet, pg. 38) 00215 void WREG(char _address, char _value); 00216 00217 // Functions for setup and data retrieval 00218 char getDeviceId(); 00219 bool getData(long *buffer); 00220 00221 void configChannel(char _channel, bool _powerDown, char _gain, char _mux); 00222 00223 #endif
Generated on Thu Jul 14 2022 00:20:03 by
1.7.2