串口ok
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#ifndef __ADC_ADS1256_H__
|
||||
#define __ADC_ADS1256_H__
|
||||
|
||||
#include "SPIDevice.h"
|
||||
|
||||
#define ADS1256_SPI_MODE 1
|
||||
#define DRATE_MAX 16
|
||||
#define DEBUG
|
||||
|
||||
#define ADS1256_GAIN_1 0 /* GAIN 1 */
|
||||
#define ADS1256_GAIN_2 1 /*GAIN 2 */
|
||||
#define ADS1256_GAIN_4 2 /*GAIN 4 */
|
||||
#define ADS1256_GAIN_8 3 /*GAIN 8 */
|
||||
#define ADS1256_GAIN_16 4 /* GAIN 16 */
|
||||
#define ADS1256_GAIN_32 5 /*GAIN 32 */
|
||||
#define ADS1256_GAIN_64 6 /*GAIN 64 */
|
||||
|
||||
|
||||
#define ADS1256_30000SPS 15
|
||||
#define ADS1256_15000SPS 14
|
||||
#define ADS1256_7500SPS 13
|
||||
#define ADS1256_3750SPS 12
|
||||
#define ADS1256_2000SPS 11
|
||||
#define ADS1256_1000SPS 10
|
||||
#define ADS1256_500SPS 9
|
||||
#define ADS1256_100SPS 8
|
||||
#define ADS1256_60SPS 7
|
||||
#define ADS1256_50SPS 6
|
||||
#define ADS1256_30SPS 5
|
||||
#define ADS1256_25SPS 4
|
||||
#define ADS1256_15SPS 3
|
||||
#define ADS1256_10SPS 2
|
||||
#define ADS1256_5SPS 1
|
||||
#define ADS1256_2d5SPS 0
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GPIO_TypeDef* _drdy;
|
||||
uint16_t _drdy_Pin;
|
||||
SPI_DEV_t* _dev;
|
||||
const char* name;
|
||||
bool success;
|
||||
|
||||
uint8_t gain;
|
||||
uint8_t dataRate;
|
||||
int32_t adcNow[8]; /* ADC Conversion value */
|
||||
uint8_t channel; /* The current channel*/
|
||||
uint8_t prevChannel; /* The previous channel --when muxing */
|
||||
uint8_t scanMode; /*Scanning mode, 0 = Single-ended input 8 channel; 1= Differential input 4 channels*/
|
||||
uint8_t buffer_en;
|
||||
uint32_t maxWaitDelay_us;
|
||||
/* gain channel? */
|
||||
|
||||
|
||||
|
||||
} ADC_ADS1256_t;
|
||||
|
||||
bool ADC_ADS1256_init(ADC_ADS1256_t *adc, const char *name, SPI_DEV_t* dev, GPIO_TypeDef* drdy, uint16_t drdy_Pin);
|
||||
|
||||
void ADC_ADS1256_update(ADC_ADS1256_t *adc);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user