ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
Loading...
Searching...
No Matches
ACDC_LTC1298_ADC.c File Reference

Implementation of the external 12-bit LTC1298 Analog to Digital Converter (ADC) More...

#include "ACDC_LTC1298_ADC.h"
#include "ACDC_SPI.h"
#include "ACDC_GPIO.h"
#include "ACDC_CLOCK.h"

Macros

#define ADC_TRANSMISSON_START   0b1000 /** Tells the ADC that a transmisson has started */
 
#define ADC_MUX_MODE_SINGLE_ENDED   0b0100 /** Sets the ADC into SINGLE-ENDED Mode */
 
#define ADC_MUX_MODE_DIFFERENTIAL   0b0000 /** Sets the ADC into DIFFERENTIAL Mode */
 
#define ADC_MUX_CHANNEL_0   0b0000 /** Enables Recieving data from Channel 0 */
 
#define ADC_MUX_CHANNEL_1   0b0010 /** Enables Recieving data from Channel 1 */
 
#define ADC_MUX_MSBFIRST   0b0001 /** Sets the Recieved data format to MSB First */
 
#define ADC_MUX_LSBFIRST   0b0000 /** Sets the Recieved data format to LSB First */
 
#define MAX_CLOCK_SPEED   200000 /** ADC MAX Clock Freq = 200kHz {See LTC1298-14} */
 

Functions

LTC1298_t LTCADC_InitCS (SPI_TypeDef *SPIx, GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN)
 Initiliazes SPIx and the external LTC1298IS8 ADC. Also sets up the software CS pin for SPIx.
 
uint16_t LTCADC_ReadCH0CS (LTC1298_t LTC_ADC)
 Reads the current ADC value on channel 0 (Software CS)
 
uint16_t LTCADC_ReadCH1CS (LTC1298_t LTC_ADC)
 Reads the current ADC value on channel 1 (SoftwareCS)
 

Detailed Description

Implementation of the external 12-bit LTC1298 Analog to Digital Converter (ADC)

Author
Devin Marx
Version
0.1
Date
2024-03-21

Macro Definition Documentation

◆ ADC_MUX_CHANNEL_0

#define ADC_MUX_CHANNEL_0   0b0000 /** Enables Recieving data from Channel 0 */

◆ ADC_MUX_CHANNEL_1

#define ADC_MUX_CHANNEL_1   0b0010 /** Enables Recieving data from Channel 1 */

◆ ADC_MUX_LSBFIRST

#define ADC_MUX_LSBFIRST   0b0000 /** Sets the Recieved data format to LSB First */

◆ ADC_MUX_MODE_DIFFERENTIAL

#define ADC_MUX_MODE_DIFFERENTIAL   0b0000 /** Sets the ADC into DIFFERENTIAL Mode */

◆ ADC_MUX_MODE_SINGLE_ENDED

#define ADC_MUX_MODE_SINGLE_ENDED   0b0100 /** Sets the ADC into SINGLE-ENDED Mode */

◆ ADC_MUX_MSBFIRST

#define ADC_MUX_MSBFIRST   0b0001 /** Sets the Recieved data format to MSB First */

◆ ADC_TRANSMISSON_START

#define ADC_TRANSMISSON_START   0b1000 /** Tells the ADC that a transmisson has started */

◆ MAX_CLOCK_SPEED

#define MAX_CLOCK_SPEED   200000 /** ADC MAX Clock Freq = 200kHz {See LTC1298-14} */

Function Documentation

◆ LTCADC_InitCS()

LTC1298_t LTCADC_InitCS ( SPI_TypeDef * SPIx,
GPIO_TypeDef * GPIOx,
uint16_t GPIO_PIN )

Initiliazes SPIx and the external LTC1298IS8 ADC. Also sets up the software CS pin for SPIx.

Parameters
SPIxSPI Peripheral (Ex. SPI1 or SPI2)
GPIOxGPIO Port for the chip select pin (Ex. GPIOA, GPIOB, ...)
GPIO_PINDesired chip select pin on port GPIOx (Ex. GPIO_PIN_0, GPIO_PIN_1, ...)
Returns
Struct containing all necessary data for the ADC

◆ LTCADC_ReadCH0CS()

uint16_t LTCADC_ReadCH0CS ( LTC1298_t LTC_ADC)

Reads the current ADC value on channel 0 (Software CS)

Parameters
LTC_ADCStruct containing configuration data for the ADC
Returns
12-bits of data representing the ADC's input on channel 0

◆ LTCADC_ReadCH1CS()

uint16_t LTCADC_ReadCH1CS ( LTC1298_t LTC_ADC)

Reads the current ADC value on channel 1 (SoftwareCS)

Parameters
LTC_ADCStruct containing configuration data for the ADC
Returns
12-bits of data representing the ADC's input on channel 1