36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
#ifndef ADS1256_CONSTANTS_H
|
|
#define ADS1256_CONSTANTS_H
|
|
|
|
#include "stm32f4xx_ll_gpio.h"
|
|
#include "stm32f4xx_ll_spi.h"
|
|
|
|
#define ADC_RDY_GPIO GPIOC
|
|
#define ADC_RDY_GPIO_PIN LL_GPIO_PIN_8
|
|
|
|
#define ADC_CS_GPIO GPIOB
|
|
#define ADC_CS_GPIO_PIN LL_GPIO_PIN_12
|
|
|
|
#define ADC_SYNC_GPIO GPIOC
|
|
#define ADC_SYNC_GPIO_PIN LL_GPIO_PIN_7
|
|
|
|
#define ADC_RST_GPIO GPIOC
|
|
#define ADC_RST_GPIO_PIN LL_GPIO_PIN_6
|
|
|
|
#define SPI_INTERFACE SPI2
|
|
|
|
|
|
#include "ads1256_defines.h"
|
|
#define ADC_SPS_SET_INIT ADC_SPS_VAR_7500_SPS
|
|
#define ADC_PGA_SET_INIT ADC_PGA_VAR_2
|
|
#define ADC_VREF 2.5
|
|
#define ADC_VIN_OFFSET -5
|
|
|
|
|
|
#define GPIO_GET_INPUT_STATE(interface, pin) LL_GPIO_IsInputPinSet(interface, pin)
|
|
#define SPI_READ(data) SPI_ReceiveData(SPI_INTERFACE, data)
|
|
#define SPI_WRITE(data) SPI_SendData(SPI_INTERFACE, data)
|
|
#define GPIO_SET_BIT(interface, pin) LL_GPIO_SetOutputPin(interface, pin)
|
|
#define GPIO_RESET_BIT(interface, pin) LL_GPIO_ResetOutputPin(interface, pin)
|
|
|
|
#endif
|