|
#ifndef __ADS1120_H
|
|
#define __ADS1120_H
|
|
|
#include "stm32f10x.h"
|
#include "datatype.h"
|
|
#define RESET 0X06
|
#define START 0X08
|
#define POWERDOWN 0X02
|
#define RDATA 0X10
|
#define RREG 0X20
|
#define WREG 0X40
|
|
//#define ads_ReadWriteByte(dat) SPI3_ReadWriteByte(dat)
|
|
|
#define SCLK_L GPIO_ResetBits(GPIOB,GPIO_Pin_1)
|
#define SCLK_H GPIO_SetBits(GPIOB,GPIO_Pin_1)
|
|
#define TEM_CS_L GPIO_ResetBits(GPIOE,GPIO_Pin_10)
|
#define TEM_CS_H GPIO_SetBits(GPIOE,GPIO_Pin_10)
|
//#define PRE_CS_L GPIO_ResetBits(GPIOE,GPIO_Pin_5)
|
//#define PRE_CS_H GPIO_SetBits(GPIOE,GPIO_Pin_5)
|
#define TEM_DRDY_IN GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_9)
|
//#define PRE_DRDY_IN GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_2)
|
#define DOUT GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_0)
|
#define DIN_L GPIO_ResetBits(GPIOC,GPIO_Pin_1)
|
#define DIN_H GPIO_SetBits(GPIOC,GPIO_Pin_1)
|
#define TEM_PRE_POWER_Power_ON PCout(5) = 1;
|
#define TEM_PRE_POWER_Power_OFF PCout(5) = 0;
|
|
void ADS1120_Init(void);
|
void WriteOneByte(unsigned char command);
|
unsigned char ReadOneByte(void);
|
int16_t ReadData(u8 ch_type);
|
void ADReset(u8 ch_type);
|
void ADPowerDown(u8 ch_type);
|
void ADStartConversion(u8 ch_type);
|
void ReadRegister(u8 ch_type);
|
void WriteRegister(unsigned char StartAddress, unsigned char NumRegs, unsigned char * pData, u8 ch_type);
|
void CofigTemAD(void);
|
float temperature_ad_value(void);
|
float pressure_ad_value(void);
|
void ADS1120_GPIO_Init(void);
|
void ADS_for_spi(void);
|
#endif
|