ads1259

Dependents:   Chromatograph_Mobile Chromatograph_Mobile

Committer:
vitlog
Date:
Mon Jun 22 09:51:45 2020 +0000
Revision:
1:533ce2102fcc
Parent:
0:f9ba28ab9f4c
ne pomnyu chto pomenyal

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vitlog 0:f9ba28ab9f4c 1 #ifndef _ADS1259_ARDUINO_H /* Guard against multiple inclusion */
vitlog 0:f9ba28ab9f4c 2 #define _ADS1259_ARDUINO_H
vitlog 0:f9ba28ab9f4c 3
vitlog 0:f9ba28ab9f4c 4 #include <stdint.h>
vitlog 0:f9ba28ab9f4c 5 #include <stdbool.h>
vitlog 0:f9ba28ab9f4c 6 #include <stddef.h>
vitlog 0:f9ba28ab9f4c 7 #include <stdlib.h>
vitlog 0:f9ba28ab9f4c 8
vitlog 0:f9ba28ab9f4c 9 /* Provide C++ Compatibility */
vitlog 0:f9ba28ab9f4c 10 #ifdef __cplusplus
vitlog 0:f9ba28ab9f4c 11 extern "C" {
vitlog 0:f9ba28ab9f4c 12 #endif
vitlog 0:f9ba28ab9f4c 13
vitlog 0:f9ba28ab9f4c 14 // commands
vitlog 0:f9ba28ab9f4c 15 #define WAKEUP_ADS1259 0x02
vitlog 0:f9ba28ab9f4c 16 #define SLEEP_ADS1259 0x04
vitlog 0:f9ba28ab9f4c 17 #define RESET_ADS1259 0x06
vitlog 0:f9ba28ab9f4c 18 #define START_ADS1259 0x08
vitlog 0:f9ba28ab9f4c 19 #define STOP_ADS1259 0x0A
vitlog 0:f9ba28ab9f4c 20 #define RDATAC_ADS1259 0x10
vitlog 0:f9ba28ab9f4c 21 #define SDATAC_ADS1259 0x11
vitlog 0:f9ba28ab9f4c 22 #define RDATA_ADS1259 0x12
vitlog 0:f9ba28ab9f4c 23 #define RREG_ADS1259 0x20
vitlog 0:f9ba28ab9f4c 24 #define WREG_ADS1259 0x40
vitlog 0:f9ba28ab9f4c 25 #define OFSCAL_ADS1259 0x18
vitlog 0:f9ba28ab9f4c 26 #define GANCAL_ADS1259 0x19
vitlog 0:f9ba28ab9f4c 27 #define WREG_ADS1259 0x40
vitlog 0:f9ba28ab9f4c 28
vitlog 0:f9ba28ab9f4c 29 // registers
vitlog 0:f9ba28ab9f4c 30 #define CONFIG0_ADS1259 0x00
vitlog 0:f9ba28ab9f4c 31 #define CONFIG1_ADS1259 0x01
vitlog 0:f9ba28ab9f4c 32 #define CONFIG2_ADS1259 0x02
vitlog 0:f9ba28ab9f4c 33 #define OFC0_ADS1259 0x03
vitlog 0:f9ba28ab9f4c 34 #define OFC1_ADS1259 0x04
vitlog 0:f9ba28ab9f4c 35 #define OFC2_ADS1259 0x05
vitlog 0:f9ba28ab9f4c 36 #define FSC0_ADS1259 0x06
vitlog 0:f9ba28ab9f4c 37 #define FSC1_ADS1259 0x07
vitlog 0:f9ba28ab9f4c 38 #define FSC2_ADS1259 0x08
vitlog 0:f9ba28ab9f4c 39
vitlog 0:f9ba28ab9f4c 40 // delay bits DELAY[2:0]
vitlog 0:f9ba28ab9f4c 41 #define DELAY_0 0
vitlog 0:f9ba28ab9f4c 42 #define DELAY_64 1
vitlog 0:f9ba28ab9f4c 43 #define DELAY_128 2
vitlog 0:f9ba28ab9f4c 44 #define DELAY_256 3
vitlog 0:f9ba28ab9f4c 45 #define DELAY_512 4
vitlog 0:f9ba28ab9f4c 46 #define DELAY_1024 5
vitlog 0:f9ba28ab9f4c 47 #define DELAY_2048 6
vitlog 0:f9ba28ab9f4c 48 #define DELAY_4096 7
vitlog 0:f9ba28ab9f4c 49
vitlog 0:f9ba28ab9f4c 50 #define TIMEOUT 1000
vitlog 0:f9ba28ab9f4c 51
vitlog 0:f9ba28ab9f4c 52 //FSC регистр
vitlog 0:f9ba28ab9f4c 53 typedef union{
vitlog 0:f9ba28ab9f4c 54 struct{
vitlog 0:f9ba28ab9f4c 55 uint32_t
vitlog 0:f9ba28ab9f4c 56 FSC0:8,
vitlog 0:f9ba28ab9f4c 57 FSC1:8,
vitlog 0:f9ba28ab9f4c 58 FSC2:8,
vitlog 0:f9ba28ab9f4c 59 :8;
vitlog 0:f9ba28ab9f4c 60 };
vitlog 0:f9ba28ab9f4c 61 struct{
vitlog 0:f9ba28ab9f4c 62 uint32_t
vitlog 0:f9ba28ab9f4c 63 FSC:24,
vitlog 0:f9ba28ab9f4c 64 :8;
vitlog 0:f9ba28ab9f4c 65 };
vitlog 0:f9ba28ab9f4c 66 }__ADS1259_FSC_t;
vitlog 0:f9ba28ab9f4c 67 extern __ADS1259_FSC_t ADS1259_FSCbits;
vitlog 0:f9ba28ab9f4c 68
vitlog 0:f9ba28ab9f4c 69 //OFC регистр
vitlog 0:f9ba28ab9f4c 70 typedef union{
vitlog 0:f9ba28ab9f4c 71 struct{
vitlog 0:f9ba28ab9f4c 72 uint32_t
vitlog 0:f9ba28ab9f4c 73 OFC0:8,
vitlog 0:f9ba28ab9f4c 74 OFC1:8,
vitlog 0:f9ba28ab9f4c 75 OFC2:8,
vitlog 0:f9ba28ab9f4c 76 :8;
vitlog 0:f9ba28ab9f4c 77 };
vitlog 0:f9ba28ab9f4c 78 struct{
vitlog 0:f9ba28ab9f4c 79 uint32_t
vitlog 0:f9ba28ab9f4c 80 OFC:24,
vitlog 0:f9ba28ab9f4c 81 :8;
vitlog 0:f9ba28ab9f4c 82 };
vitlog 0:f9ba28ab9f4c 83 }__ADS1259_OFC_t;
vitlog 0:f9ba28ab9f4c 84 extern __ADS1259_OFC_t ADS1259_OFCbits;
vitlog 0:f9ba28ab9f4c 85
vitlog 0:f9ba28ab9f4c 86
vitlog 0:f9ba28ab9f4c 87
vitlog 0:f9ba28ab9f4c 88 //unsigned char ads1259_RegistersContent[9]; //переменная для хранения содержимого прочитанных регистров
vitlog 0:f9ba28ab9f4c 89
vitlog 0:f9ba28ab9f4c 90
vitlog 0:f9ba28ab9f4c 91 void ads1259_resetDevice ( unsigned char ch );
vitlog 0:f9ba28ab9f4c 92 void ads1259_powerDownDevice ( unsigned char adr );
vitlog 0:f9ba28ab9f4c 93 void ads1259_powerUpDevice ( unsigned char adr );
vitlog 0:f9ba28ab9f4c 94 void ads1259_conversionON ( unsigned char ch );
vitlog 0:f9ba28ab9f4c 95 void ads1259_conversionOFF ( unsigned char ch );
vitlog 0:f9ba28ab9f4c 96 char ads1259_readyDevice ( unsigned char ch );
vitlog 0:f9ba28ab9f4c 97 unsigned char ads1259_sendCommandDevice ( unsigned char command );
vitlog 0:f9ba28ab9f4c 98 void ads1259_setCsAndReset ( void );
vitlog 0:f9ba28ab9f4c 99 unsigned long ads1259_readRegisterDevice ( unsigned char reg, unsigned char num_reg, unsigned char ch );
vitlog 0:f9ba28ab9f4c 100 unsigned char ads1259_readOneRegisterDevice ( unsigned char reg );
vitlog 0:f9ba28ab9f4c 101 void ads1259_writeOneRegisterDevice ( unsigned char reg, unsigned char data );
vitlog 0:f9ba28ab9f4c 102 void ads1259_runReadDataContinuedModeDevice ( unsigned char ch );
vitlog 0:f9ba28ab9f4c 103 uint32_t ads1259_readDataDevice ( unsigned char ch );
vitlog 0:f9ba28ab9f4c 104
vitlog 0:f9ba28ab9f4c 105
vitlog 0:f9ba28ab9f4c 106 /* Provide C++ Compatibility */
vitlog 0:f9ba28ab9f4c 107 #ifdef __cplusplus
vitlog 0:f9ba28ab9f4c 108 }
vitlog 0:f9ba28ab9f4c 109 #endif
vitlog 0:f9ba28ab9f4c 110
vitlog 0:f9ba28ab9f4c 111 #endif /* _EXAMPLE_FILE_NAME_H */
vitlog 0:f9ba28ab9f4c 112
vitlog 0:f9ba28ab9f4c 113 /* *****************************************************************************
vitlog 0:f9ba28ab9f4c 114 End of File
vitlog 0:f9ba28ab9f4c 115 */