ADS_BP
ADS1299.h
Go to the documentation of this file.
1 
16 #ifndef ADS1299_H_
17 #define ADS1299_H_
18 
19 
20 /* libraries */
21 #include <stdint.h>
22 #include <stdbool.h>
23 #include "inc/hw_memmap.h"
24 #include "driverlib/gpio.h"
25 #include "driverlib/sysctl.h"
26 #include "driverlib/ssi.h"
27 
28 
29 /* defines */
30 // MCU Pheripherals and Pins
31 #define ADS_NPWDN_PORT 0
32 #define ADS_NPWDN_PIN 0
33 #define ADS_NRST_PORT GPIO_PORTD_BASE
34 #define ADS_NRST_PIN GPIO_PIN_2 // check: PD7 needs to be unlocked first
35 #define ADS_START_PORT GPIO_PORTD_BASE
36 #define ADS_START_PIN GPIO_PIN_1
37 #define ADS_NCS_PORT GPIO_PORTA_BASE
38 #define ADS_NCS_PIN GPIO_PIN_0
39 #define ADS_SSI_PHERIPH SYSCTL_PERIPH_SSI0
40 #define ADS_SSI_BASE SSI0_BASE
41 #define ADS_SSI_PORT GPIO_PORTA_BASE
42 #define ADS_SSIRX_PIN GPIO_PA4_SSI0RX
43 #define ADS_SSITX_PIN GPIO_PA5_SSI0TX
44 #define ADS_SSISCLK_PIN GPIO_PA2_SSI0CLK
45 #define ADS_NDRDY_PORT GPIO_PORTC_BASE
46 #define ADS_NDRDY_PIN GPIO_INT_PIN_5
47 #define ADS_NDRDY_INT INT_GPIOA_TM4C123
48 
49 // ADS1299 registers
50 #define ADSregID 0x00
51 #define ADSregCONFIG1 0x01
52 #define ADSregCONFIG2 0x02
53 #define ADSregCONFIG3 0x03
54 #define ADSregCH1SET 0x05
55 
56 // ADS1299 SPI commands
57 #define WREG 0x40
58 #define RREG 0x20
59 #define SDATAC 0x11
60 #define RDATAC 0x10
61 #define RDATA 0x12
62 
63 /* Before sending a new command to the ADS1299, we must wait at least
64  * t_ADS_decode = 4*t_ADS_clk = 1.96us. So, we wait 3us. */
65 #define ADS_CMD_DELAY (clockFreq/(3*300000))
66 
67 /* structures */
68 
69 
70 /* prototypes */
71 void ADS1299Init(void);
72 void ADS1299ReadContinuousMode(void);
73 void ADS1299StopContinuousMode(void);
74 void ADS1299ReadAllReg(unsigned char *registers);
75 void ADS1299SetInputModeSetGain(unsigned char mode, unsigned char gain);
76 void ADS1299SetDataRate(unsigned char mode);
77 unsigned char ADS1299TestSignal(unsigned char enable);
78 void ADS1299AcquireSample(unsigned char nCh, int *chValues);
79 
80 
81 /* global variables */
82 
83 
84 #endif /* ADS1299_H_ */
void ADS1299ReadContinuousMode(void)
Routine to start the continuous acquisition mode.
Definition: ADS1299.c:247
void ADS1299StopContinuousMode(void)
Routine to stop the continuous acquisition mode.
Definition: ADS1299.c:279
void ADS1299ReadAllReg(unsigned char *registers)
Routine to read all values from ADS1299 registers. It receives a pointer to a 25 bytes chars array...
Definition: ADS1299.c:182
unsigned char ADS1299TestSignal(unsigned char enable)
This function enables or disables the generation of a test signal built in the ADS1299. It also modifies the input multiplexer configuration shorting the input channels to the test signal.
Definition: ADS1299.c:564
void ADS1299AcquireSample(unsigned char nCh, int *chValues)
This function reads the 27 bytes coming from ADS1299, processes them converting from complement-of-tw...
Definition: ADS1299.c:491
void ADS1299Init(void)
This function executes the ADS1299 power-on procedure and initializes all needed config registers...
Definition: ADS1299.c:48
void ADS1299SetInputModeSetGain(unsigned char mode, unsigned char gain)
This function writes the ADS1299 channel config registers in way to set the output mode of the multip...
Definition: ADS1299.c:333
void ADS1299SetDataRate(unsigned char mode)
This function writes the ADS1299 CONFIG1 register in way to set the output data rate.
Definition: ADS1299.c:471