Vitaliy Loginov / PGA280_ADS1259

Dependents:   Chromatograph_Mobile Chromatograph_Mobile

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ADS1259.h Source File

ADS1259.h

00001 #ifndef _ADS1259_ARDUINO_H    /* Guard against multiple inclusion */
00002 #define _ADS1259_ARDUINO_H
00003 
00004 #include <stdint.h>
00005 #include <stdbool.h>
00006 #include <stddef.h>
00007 #include <stdlib.h>
00008 
00009 /* Provide C++ Compatibility */
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013 
00014 // commands
00015 #define WAKEUP_ADS1259    0x02
00016 #define SLEEP_ADS1259     0x04
00017 #define RESET_ADS1259     0x06
00018 #define START_ADS1259     0x08
00019 #define STOP_ADS1259      0x0A
00020 #define RDATAC_ADS1259    0x10
00021 #define SDATAC_ADS1259    0x11
00022 #define RDATA_ADS1259     0x12
00023 #define RREG_ADS1259      0x20
00024 #define WREG_ADS1259      0x40
00025 #define OFSCAL_ADS1259    0x18
00026 #define GANCAL_ADS1259    0x19
00027 #define WREG_ADS1259      0x40
00028 
00029 // registers
00030 #define CONFIG0_ADS1259   0x00
00031 #define CONFIG1_ADS1259   0x01
00032 #define CONFIG2_ADS1259   0x02
00033 #define OFC0_ADS1259      0x03
00034 #define OFC1_ADS1259      0x04
00035 #define OFC2_ADS1259      0x05
00036 #define FSC0_ADS1259      0x06
00037 #define FSC1_ADS1259      0x07
00038 #define FSC2_ADS1259      0x08
00039 
00040 // delay bits DELAY[2:0]
00041 #define DELAY_0           0
00042 #define DELAY_64          1
00043 #define DELAY_128         2
00044 #define DELAY_256         3
00045 #define DELAY_512         4
00046 #define DELAY_1024        5
00047 #define DELAY_2048        6
00048 #define DELAY_4096        7
00049 
00050 #define TIMEOUT           1000
00051 
00052 //FSC регистр
00053 typedef union{
00054     struct{
00055         uint32_t
00056         FSC0:8,
00057         FSC1:8,
00058         FSC2:8,
00059         :8;
00060     };
00061     struct{
00062         uint32_t
00063         FSC:24,
00064         :8;
00065     };
00066 }__ADS1259_FSC_t;
00067 extern __ADS1259_FSC_t ADS1259_FSCbits;
00068 
00069 //OFC регистр
00070 typedef union{
00071     struct{
00072         uint32_t
00073         OFC0:8,
00074         OFC1:8,
00075         OFC2:8,
00076         :8;
00077     };
00078     struct{
00079         uint32_t
00080         OFC:24,
00081         :8;
00082     };
00083 }__ADS1259_OFC_t;
00084 extern __ADS1259_OFC_t ADS1259_OFCbits;
00085 
00086 
00087 
00088 //unsigned char ads1259_RegistersContent[9]; //переменная для хранения содержимого прочитанных регистров
00089     
00090     
00091     void ads1259_resetDevice ( unsigned char ch );
00092     void ads1259_powerDownDevice ( unsigned char adr );
00093     void ads1259_powerUpDevice ( unsigned char adr );
00094     void ads1259_conversionON ( unsigned char ch );
00095     void ads1259_conversionOFF ( unsigned char ch );
00096     char ads1259_readyDevice ( unsigned char ch );
00097     unsigned char ads1259_sendCommandDevice ( unsigned char command );
00098     void ads1259_setCsAndReset ( void );
00099     unsigned long ads1259_readRegisterDevice ( unsigned char reg, unsigned char num_reg, unsigned char ch );
00100     unsigned char ads1259_readOneRegisterDevice ( unsigned char reg );
00101     void ads1259_writeOneRegisterDevice ( unsigned char reg, unsigned char data );
00102     void ads1259_runReadDataContinuedModeDevice ( unsigned char ch );
00103     uint32_t ads1259_readDataDevice ( unsigned char ch );
00104     
00105 
00106     /* Provide C++ Compatibility */
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif /* _EXAMPLE_FILE_NAME_H */
00112 
00113 /* *****************************************************************************
00114  End of File
00115  */