Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ads1220.h File Reference

Driver for the ADS1220 24-bits ADC from TI SPI communication. More...

#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/spi.h"
+ Include dependency graph for ads1220.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Ads1220Config
 ADS1220 configuration options. More...
 
struct  Ads1220
 

Macros

#define ADS1220_BUFFER_LEN   5
 

Enumerations

enum  Ads1220ConfStatus { ADS1220_UNINIT = 0, ADS1220_SEND_RESET, ADS1220_INITIALIZING, ADS1220_INITIALIZED }
 
enum  Ads1220Mux {
  ADS1220_MUX_AIN0_AIN1 = 0, ADS1220_MUX_AIN0_AIN2, ADS1220_MUX_AIN0_AIN3, ADS1220_MUX_AIN1_AIN2,
  ADS1220_MUX_AIN1_AIN3, ADS1220_MUX_AIN2_AIN3, ADS1220_MUX_AIN1_AIN0, ADS1220_MUX_AIN3_AIN2,
  ADS1220_MUX_AIN0_AVSS, ADS1220_MUX_AIN1_AVSS, ADS1220_MUX_AIN2_AVSS, ADS1220_MUX_AIN3_AVSS,
  ADS1220_MUX_REFP_REFN, ADS1220_MUX_AVDD_AVSS, ADS1220_MUX_AVDD_AVSS_2
}
 
enum  Ads1220Gain {
  ADS1220_GAIN_1 = 0, ADS1220_GAIN_2, ADS1220_GAIN_4, ADS1220_GAIN_8,
  ADS1220_GAIN_16, ADS1220_GAIN_32, ADS1220_GAIN_64, ADS1220_GAIN_128
}
 
enum  Ads1220SampleRate { ADS1220_RATE_20_HZ = 0, ADS1220_RATE_45_HZ, ADS1220_RATE_90_HZ, ADS1220_RATE_175_HZ }
 
enum  Ads1220ConvMode { ADS1220_SINGLE_SHOT = 0, ADS1220_CONTINIOUS_CONVERSION }
 
enum  Ads1220VRef { ADS1220_VREF_INTERNAL = 0, ADS1220_VREF_EXTERNAL_REF, ADS1220_VREF_EXTERNAL_AIN, ADS1220_VREF_VDD }
 
enum  Ads1220Idac {
  ADS1220_IDAC_OFF = 0, ADS1220_IDAC_10_uA, ADS1220_IDAC_50_uA, ADS1220_IDAC_100_uA,
  ADS1220_IDAC_250_uA, ADS1220_IDAC_500_uA, ADS1220_IDAC_1000_uA, ADS1220_IDAC_1500_uA
}
 
enum  Ads1220Imux {
  ADS1220_IMUX_OFF = 0, ADS1220_IMUX_A0_RP1, ADS1220_IMUX_A1, ADS1220_IMUX_A2,
  ADS1220_IMUX_A3_RN1, ADS1220_IMUX_RP0, ADS1220_IMUX_RN0
}
 

Functions

void ads1220_init (struct Ads1220 *ads, struct spi_periph *spi_p, uint8_t slave_idx)
 
void ads1220_configure (struct Ads1220 *ads)
 
void ads1220_read (struct Ads1220 *ads)
 
void ads1220_event (struct Ads1220 *ads)
 
static void ads1220_periodic (struct Ads1220 *ads)
 convenience function: read or start configuration if not already initialized More...
 

Variables

static const float Ads1220GainTable []
 

Detailed Description

Driver for the ADS1220 24-bits ADC from TI SPI communication.

Definition in file ads1220.h.


Data Structure Documentation

struct Ads1220Config

ADS1220 configuration options.

Definition at line 129 of file ads1220.h.

Data Fields
enum Ads1220ConvMode conv conversion mode
enum Ads1220Gain gain gain
enum Ads1220Imux i1mux IDAC routing 1.
enum Ads1220Imux i2mux IDAC routing 2.
enum Ads1220Idac idac IDAC config.
enum Ads1220Mux mux input multiplexer
bool pga_bypass bypass PGA (PGA enabled = 0)
enum Ads1220SampleRate rate data output rate
enum Ads1220ConfStatus status config status
enum Ads1220VRef vref voltage ref
struct Ads1220

Definition at line 151 of file ads1220.h.

+ Collaboration diagram for Ads1220:
Data Fields
struct Ads1220Config config configuration
uint32_t data raw ADC value
volatile bool data_available data ready flag
volatile uint8_t rx_buf[ADS1220_BUFFER_LEN] receive buffer
struct spi_periph * spi_p spi peripheral
struct spi_transaction spi_trans spi transaction
volatile uint8_t tx_buf[ADS1220_BUFFER_LEN] transmit buffer

Macro Definition Documentation

#define ADS1220_BUFFER_LEN   5

Definition at line 149 of file ads1220.h.

Enumeration Type Documentation

Enumerator
ADS1220_UNINIT 
ADS1220_SEND_RESET 
ADS1220_INITIALIZING 
ADS1220_INITIALIZED 

Definition at line 39 of file ads1220.h.

Enumerator
ADS1220_SINGLE_SHOT 
ADS1220_CONTINIOUS_CONVERSION 

Definition at line 91 of file ads1220.h.

Enumerator
ADS1220_GAIN_1 
ADS1220_GAIN_2 
ADS1220_GAIN_4 
ADS1220_GAIN_8 
ADS1220_GAIN_16 
ADS1220_GAIN_32 
ADS1220_GAIN_64 
ADS1220_GAIN_128 

Definition at line 66 of file ads1220.h.

Enumerator
ADS1220_IDAC_OFF 
ADS1220_IDAC_10_uA 
ADS1220_IDAC_50_uA 
ADS1220_IDAC_100_uA 
ADS1220_IDAC_250_uA 
ADS1220_IDAC_500_uA 
ADS1220_IDAC_1000_uA 
ADS1220_IDAC_1500_uA 

Definition at line 105 of file ads1220.h.

Enumerator
ADS1220_IMUX_OFF 
ADS1220_IMUX_A0_RP1 
ADS1220_IMUX_A1 
ADS1220_IMUX_A2 
ADS1220_IMUX_A3_RN1 
ADS1220_IMUX_RP0 
ADS1220_IMUX_RN0 

Definition at line 117 of file ads1220.h.

enum Ads1220Mux
Enumerator
ADS1220_MUX_AIN0_AIN1 
ADS1220_MUX_AIN0_AIN2 
ADS1220_MUX_AIN0_AIN3 
ADS1220_MUX_AIN1_AIN2 
ADS1220_MUX_AIN1_AIN3 
ADS1220_MUX_AIN2_AIN3 
ADS1220_MUX_AIN1_AIN0 
ADS1220_MUX_AIN3_AIN2 
ADS1220_MUX_AIN0_AVSS 
ADS1220_MUX_AIN1_AVSS 
ADS1220_MUX_AIN2_AVSS 
ADS1220_MUX_AIN3_AVSS 
ADS1220_MUX_REFP_REFN 
ADS1220_MUX_AVDD_AVSS 
ADS1220_MUX_AVDD_AVSS_2 

Definition at line 47 of file ads1220.h.

Enumerator
ADS1220_RATE_20_HZ 
ADS1220_RATE_45_HZ 
ADS1220_RATE_90_HZ 
ADS1220_RATE_175_HZ 

Definition at line 83 of file ads1220.h.

Enumerator
ADS1220_VREF_INTERNAL 
ADS1220_VREF_EXTERNAL_REF 
ADS1220_VREF_EXTERNAL_AIN 
ADS1220_VREF_VDD 

Definition at line 97 of file ads1220.h.

Function Documentation

void ads1220_configure ( struct Ads1220 ads)
static void ads1220_periodic ( struct Ads1220 ads)
inlinestatic

convenience function: read or start configuration if not already initialized

Definition at line 171 of file ads1220.h.

References ads1220_configure(), ADS1220_INITIALIZED, ads1220_read(), Ads1220::config, and Ads1220Config::status.

Referenced by meteo_stick_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ads1220_read ( struct Ads1220 ads)

Definition at line 120 of file ads1220.c.

References ADS1220_INITIALIZED, Ads1220::config, spi_transaction::input_length, spi_transaction::output_length, Ads1220::spi_p, spi_submit(), Ads1220::spi_trans, SPITransDone, spi_transaction::status, and Ads1220Config::status.

Referenced by ads1220_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const float Ads1220GainTable[]
static
Initial value:
= {
1.0f, 2.0f, 4.0f, 8.0f, 16.0f, 32.0f, 64.0f, 128.0f
}

Definition at line 78 of file ads1220.h.

Referenced by get_diff(), and get_temp().