Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
ads1114.h File Reference
#include "std.h"
#include "mcu_periph/i2c.h"
+ Include dependency graph for ads1114.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ads1114_periph
 

Macros

#define ADS1114_1_I2C_ADDR   0x90
 
#define ADS1114_2_I2C_ADDR   0x92
 
#define ADS1114_POINTER_CONV_REG   0x00
 
#define ADS1114_POINTER_CONFIG_REG   0x01
 
#define ADS1114_1_OS   0x0
 
#define ADS1114_1_MUX   0x0
 
#define ADS1114_1_PGA   0x3
 
#define ADS1114_1_MODE   0x0
 
#define ADS1114_1_DR   0x4
 
#define ADS1114_1_COMP_MODE   0x0
 
#define ADS1114_1_COMP_POL   0x0
 
#define ADS1114_1_COMP_LAT   0x0
 
#define ADS1114_1_COMP_QUE   0x3
 
#define ADS1114_1_CONFIG_MSB   ((ADS1114_1_OS<<7)|(ADS1114_1_MUX<<4)|(ADS1114_1_PGA<<1)|(ADS1114_1_MODE))
 
#define ADS1114_1_CONFIG_LSB   ((ADS1114_1_DR<<5)|(ADS1114_1_COMP_MODE<<4)|(ADS1114_1_COMP_POL<<3)|(ADS1114_1_COMP_LAT<<2)|(ADS1114_1_COMP_QUE))
 
#define ADS1114_2_OS   0x0
 
#define ADS1114_2_MUX   0x0
 
#define ADS1114_2_PGA   0x3
 
#define ADS1114_2_MODE   0x0
 
#define ADS1114_2_DR   0x4
 
#define ADS1114_2_COMP_MODE   0x0
 
#define ADS1114_2_COMP_POL   0x0
 
#define ADS1114_2_COMP_LAT   0x0
 
#define ADS1114_2_COMP_QUE   0x3
 
#define ADS1114_2_CONFIG_MSB   ((ADS1114_2_OS<<7)|(ADS1114_2_MUX<<4)|(ADS1114_2_PGA<<1)|(ADS1114_2_MODE))
 
#define ADS1114_2_CONFIG_LSB   ((ADS1114_2_DR<<5)|(ADS1114_2_COMP_MODE<<4)|(ADS1114_2_COMP_POL<<3)|(ADS1114_2_COMP_LAT<<2)|(ADS1114_2_COMP_QUE))
 
#define ADS1114_I2C_DEV   i2c1
 
#define _Ads1114Event(_p)
 
#define Ads1114_1Event()   {}
 
#define Ads1114_2Event()   {}
 
#define Ads1114Event()
 
#define Ads1114GetValue(_p)   ((int16_t)(((int16_t)_p.trans.buf[0]<<8)|_p.trans.buf[1]))
 

Functions

void ads1114_init (void)
 
void ads1114_read (struct ads1114_periph *p)
 

Data Structure Documentation

◆ ads1114_periph

struct ads1114_periph

Definition at line 116 of file ads1114.h.

+ Collaboration diagram for ads1114_periph:
Data Fields
bool config_done
bool data_available
uint8_t i2c_addr
struct i2c_transaction trans

Macro Definition Documentation

◆ _Ads1114Event

#define _Ads1114Event (   _p)
Value:
{\
if (!_p.config_done) { \
if (_p.trans.status == I2CTransSuccess) { _p.config_done = true; _p.trans.status = I2CTransDone; } \
if (_p.trans.status == I2CTransFailed) { _p.trans.status = I2CTransDone; } \
} else { \
if (_p.trans.status == I2CTransSuccess) { _p.data_available = true; _p.trans.status = I2CTransDone; } \
if (_p.trans.status == I2CTransFailed) { _p.trans.status = I2CTransDone; } \
} \
}

Definition at line 135 of file ads1114.h.

◆ ADS1114_1_COMP_LAT

#define ADS1114_1_COMP_LAT   0x0

Definition at line 69 of file ads1114.h.

◆ ADS1114_1_COMP_MODE

#define ADS1114_1_COMP_MODE   0x0

Definition at line 63 of file ads1114.h.

◆ ADS1114_1_COMP_POL

#define ADS1114_1_COMP_POL   0x0

Definition at line 66 of file ads1114.h.

◆ ADS1114_1_COMP_QUE

#define ADS1114_1_COMP_QUE   0x3

Definition at line 72 of file ads1114.h.

◆ ADS1114_1_CONFIG_LSB

#define ADS1114_1_CONFIG_LSB   ((ADS1114_1_DR<<5)|(ADS1114_1_COMP_MODE<<4)|(ADS1114_1_COMP_POL<<3)|(ADS1114_1_COMP_LAT<<2)|(ADS1114_1_COMP_QUE))

Definition at line 76 of file ads1114.h.

◆ ADS1114_1_CONFIG_MSB

#define ADS1114_1_CONFIG_MSB   ((ADS1114_1_OS<<7)|(ADS1114_1_MUX<<4)|(ADS1114_1_PGA<<1)|(ADS1114_1_MODE))

Definition at line 75 of file ads1114.h.

◆ ADS1114_1_DR

#define ADS1114_1_DR   0x4

Definition at line 60 of file ads1114.h.

◆ ADS1114_1_I2C_ADDR

#define ADS1114_1_I2C_ADDR   0x90

Definition at line 36 of file ads1114.h.

◆ ADS1114_1_MODE

#define ADS1114_1_MODE   0x0

Definition at line 57 of file ads1114.h.

◆ ADS1114_1_MUX

#define ADS1114_1_MUX   0x0

Definition at line 51 of file ads1114.h.

◆ ADS1114_1_OS

#define ADS1114_1_OS   0x0

Definition at line 48 of file ads1114.h.

◆ ADS1114_1_PGA

#define ADS1114_1_PGA   0x3

Definition at line 54 of file ads1114.h.

◆ Ads1114_1Event

#define Ads1114_1Event ( )    {}

Definition at line 148 of file ads1114.h.

◆ ADS1114_2_COMP_LAT

#define ADS1114_2_COMP_LAT   0x0

Definition at line 101 of file ads1114.h.

◆ ADS1114_2_COMP_MODE

#define ADS1114_2_COMP_MODE   0x0

Definition at line 95 of file ads1114.h.

◆ ADS1114_2_COMP_POL

#define ADS1114_2_COMP_POL   0x0

Definition at line 98 of file ads1114.h.

◆ ADS1114_2_COMP_QUE

#define ADS1114_2_COMP_QUE   0x3

Definition at line 104 of file ads1114.h.

◆ ADS1114_2_CONFIG_LSB

#define ADS1114_2_CONFIG_LSB   ((ADS1114_2_DR<<5)|(ADS1114_2_COMP_MODE<<4)|(ADS1114_2_COMP_POL<<3)|(ADS1114_2_COMP_LAT<<2)|(ADS1114_2_COMP_QUE))

Definition at line 108 of file ads1114.h.

◆ ADS1114_2_CONFIG_MSB

#define ADS1114_2_CONFIG_MSB   ((ADS1114_2_OS<<7)|(ADS1114_2_MUX<<4)|(ADS1114_2_PGA<<1)|(ADS1114_2_MODE))

Definition at line 107 of file ads1114.h.

◆ ADS1114_2_DR

#define ADS1114_2_DR   0x4

Definition at line 92 of file ads1114.h.

◆ ADS1114_2_I2C_ADDR

#define ADS1114_2_I2C_ADDR   0x92

Definition at line 39 of file ads1114.h.

◆ ADS1114_2_MODE

#define ADS1114_2_MODE   0x0

Definition at line 89 of file ads1114.h.

◆ ADS1114_2_MUX

#define ADS1114_2_MUX   0x0

Definition at line 83 of file ads1114.h.

◆ ADS1114_2_OS

#define ADS1114_2_OS   0x0

Definition at line 80 of file ads1114.h.

◆ ADS1114_2_PGA

#define ADS1114_2_PGA   0x3

Definition at line 86 of file ads1114.h.

◆ Ads1114_2Event

#define Ads1114_2Event ( )    {}

Definition at line 154 of file ads1114.h.

◆ ADS1114_I2C_DEV

#define ADS1114_I2C_DEV   i2c1

Definition at line 113 of file ads1114.h.

◆ ADS1114_POINTER_CONFIG_REG

#define ADS1114_POINTER_CONFIG_REG   0x01

Definition at line 44 of file ads1114.h.

◆ ADS1114_POINTER_CONV_REG

#define ADS1114_POINTER_CONV_REG   0x00

Definition at line 43 of file ads1114.h.

◆ Ads1114Event

#define Ads1114Event ( )
Value:
{ \
Ads1114_1Event(); \
Ads1114_2Event(); \
}

Definition at line 158 of file ads1114.h.

◆ Ads1114GetValue

#define Ads1114GetValue (   _p)    ((int16_t)(((int16_t)_p.trans.buf[0]<<8)|_p.trans.buf[1]))

Definition at line 165 of file ads1114.h.

Function Documentation

◆ ads1114_init()

void ads1114_init ( void  )

Definition at line 37 of file ads1114.c.

References ADS1114_1_CONFIG_LSB, ADS1114_1_CONFIG_MSB, ADS1114_1_I2C_ADDR, ADS1114_2_CONFIG_LSB, ADS1114_2_CONFIG_MSB, ADS1114_2_I2C_ADDR, ADS1114_I2C_DEV, ADS1114_POINTER_CONFIG_REG, and i2c_transmit().

Referenced by baro_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ads1114_read()

void ads1114_read ( struct ads1114_periph p)

Definition at line 63 of file ads1114.c.

References ADS1114_I2C_DEV, ADS1114_POINTER_CONV_REG, i2c_transceive(), I2CTransDone, and p.

Referenced by airspeed_periodic(), and baro_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
I2CTransFailed
@ I2CTransFailed
transaction failed
Definition: i2c.h:58
I2CTransSuccess
@ I2CTransSuccess
transaction successfully finished by I2C driver
Definition: i2c.h:57
I2CTransDone
@ I2CTransDone
transaction set to done by user level
Definition: i2c.h:59