I2C_Drivers (ARM) 1.1
SMFSW collection of HAL I2C Drivers for ARM
Loading...
Searching...
No Matches
ADS1115.h File Reference

ADS1115 Driver. More...

#include "sarmfsw.h"
#include "I2C_component.h"
#include "I2C_peripheral.h"
#include "ADS1115_proc.h"
#include "ADS1115_ex.h"
Include dependency graph for ADS1115.h:
This graph shows which files directly or indirectly include this file:

Data Structures

union  uADS1115_REG__CFG
 Union for Config register of ADS1115. More...
 

Macros

#define I2C_ADS1115_NB   1U
 Number of ADS1115 peripherals.
 
#define ADS1115_ADDR_GND   0x48U
 ADS1115 address (ADR tied to GND)
 
#define ADS1115_ADDR_VDD   0x49U
 ADS1115 address (ADR tied to VDD)
 
#define ADS1115_ADDR_SDA   0x4AU
 ADS1115 address (ADR tied to SDA)
 
#define ADS1115_ADDR_SCL   0x4BU
 ADS1115 address (ADR tied to SCL)
 
#define ADS1115_BASE_ADDR   ADS1115_ADDR_GND
 ADS1115 Base address.
 

Enumerations

enum  ADS1115_reg { ADS1115__CONVERSION = 0U , ADS1115__CONFIG , ADS1115__LOW_THRESH , ADS1115__HI_THRESH }
 Register map enum of ADS1115. More...
 
enum  ADS1115_mux {
  ADS1115__MUX_pAIN0_nAIN1 = 0U , ADS1115__MUX_pAIN0_nAIN3 , ADS1115__MUX_pAIN1_nAIN3 , ADS1115__MUX_pAIN2_nAIN3 ,
  ADS1115__MUX_pAIN0_nGND , ADS1115__MUX_pAIN1_nGND , ADS1115__MUX_pAIN2_nGND , ADS1115__MUX_pAIN3_nGND
}
 MUX enum for ADS1115. More...
 
enum  ADS1115_gain {
  ADS1115__FS_6144mV = 0U , ADS1115__FS_4096mV , ADS1115__FS_2048mV , ADS1115__FS_1024mV ,
  ADS1115__FS_512mV , ADS1115__FS_256mV , ADS1115__FS_256mV_2 , ADS1115__FS_256mV_3
}
 GAIN enum for ADS1115. More...
 
enum  ADS1115_mode { ADS1115__MODE_CONTINUOUS = 0U , ADS1115__MODE_SINGLE_SHOT }
 MODE enum for ADS1115. More...
 
enum  ADS1115_rate {
  ADS1115__SPS_8 = 0U , ADS1115__SPS_16 , ADS1115__SPS_32 , ADS1115__SPS_64 ,
  ADS1115__SPS_128 , ADS1115__SPS_250 , ADS1115__SPS_475 , ADS1115__SPS_860
}
 Data rate enum for ADS1115. More...
 
enum  ADS1115_comp { ADS1115__COMP_HYST = 0U , ADS1115__COMP_WINDOW }
 Comparator Mode enum for ADS1115. More...
 
enum  ADS1115_polarity { ADS1115__POL_LOW = 0U , ADS1115__POL_HIGH }
 Comparator Polarity enum for ADS1115. More...
 
enum  ADS1115_latch { ADS1115__LATCH_DISABLE = 0U , ADS1115__LATCH_ENABLE }
 Comparator Latching enum for ADS1115. More...
 
enum  ADS1115_queue { ADS1115__QUEUE_1CONV = 0U , ADS1115__QUEUE_2CONV , ADS1115__QUEUE_4CONV , ADS1115__QUEUE_DISABLE }
 Comparator Queue and Disable enum for ADS1115. More...
 

Functions

FctERR ADS1115_Init (const uint8_t idx, I2C_HandleTypeDef *const hi2c, const uint16_t devAddress)
 Initialization for ADS1115 peripheral.
 
FctERR ADS1115_Init_Single (void)
 Initialization for ADS1115 peripheral.
 
FctERR ADS1115_Write (I2C_slave_t *const pSlave, const uint16_t *data, const uint16_t addr)
 I2C Write function for ADS1115.
 
FctERR ADS1115_Read (I2C_slave_t *const pSlave, uint16_t *data, const uint16_t addr)
 I2C Read function for ADS1115.
 

Detailed Description

ADS1115 Driver.

Author
SMFSW

ADS1115: Ultra-Small, Low-Power, 16-Bit Analog-to-Digital Converter with Internal Reference

Note
Compatibility with:
  • ADS1113 (restrictions given in datasheet)
  • ADS1114 (restrictions given in datasheet)
  • ADS1115
Compatibility should be assured with:
  • ADS1x1x (check datasheets for compatibility informations)

Macro Definition Documentation

◆ ADS1115_ADDR_GND

#define ADS1115_ADDR_GND   0x48U

ADS1115 address (ADR tied to GND)

◆ ADS1115_ADDR_SCL

#define ADS1115_ADDR_SCL   0x4BU

ADS1115 address (ADR tied to SCL)

◆ ADS1115_ADDR_SDA

#define ADS1115_ADDR_SDA   0x4AU

ADS1115 address (ADR tied to SDA)

◆ ADS1115_ADDR_VDD

#define ADS1115_ADDR_VDD   0x49U

ADS1115 address (ADR tied to VDD)

◆ ADS1115_BASE_ADDR

#define ADS1115_BASE_ADDR   ADS1115_ADDR_GND

ADS1115 Base address.

Note
Define ADS1115_BASE_ADDR to change default device base address

◆ I2C_ADS1115_NB

#define I2C_ADS1115_NB   1U

Number of ADS1115 peripherals.

Note
Define I2C_ADS1115_NB to enable multiple peripherals of this type

Enumeration Type Documentation

◆ ADS1115_comp

Comparator Mode enum for ADS1115.

Enumerator
ADS1115__COMP_HYST 

Traditional comparator with hysteresis.

ADS1115__COMP_WINDOW 

Window comparator.

◆ ADS1115_gain

GAIN enum for ADS1115.

Enumerator
ADS1115__FS_6144mV 

FS = ±6.144V (step = 187.5µV)

ADS1115__FS_4096mV 

FS = ±4.096V (step = 125µV)

ADS1115__FS_2048mV 

FS = ±2.048V (step = 62.5µV)

ADS1115__FS_1024mV 

FS = ±1.024V (step = 31.25µV)

ADS1115__FS_512mV 

FS = ±0.512V (step = 15.625µV)

ADS1115__FS_256mV 

FS = ±0.256V (step = 7.8125µV)

ADS1115__FS_256mV_2 

FS = ±0.256V (step = 7.8125µV)

ADS1115__FS_256mV_3 

FS = ±0.256V (step = 7.8125µV)

◆ ADS1115_latch

Comparator Latching enum for ADS1115.

Enumerator
ADS1115__LATCH_DISABLE 

Non-latching comparator.

ADS1115__LATCH_ENABLE 

Latching comparator.

◆ ADS1115_mode

MODE enum for ADS1115.

Enumerator
ADS1115__MODE_CONTINUOUS 

Continuous conversion mode.

ADS1115__MODE_SINGLE_SHOT 

Power-down single-shot mode.

◆ ADS1115_mux

MUX enum for ADS1115.

Enumerator
ADS1115__MUX_pAIN0_nAIN1 

AINP = AIN0 and AINN = AIN1.

ADS1115__MUX_pAIN0_nAIN3 

AINP = AIN0 and AINN = AIN3.

ADS1115__MUX_pAIN1_nAIN3 

AINP = AIN1 and AINN = AIN3.

ADS1115__MUX_pAIN2_nAIN3 

AINP = AIN2 and AINN = AIN3.

ADS1115__MUX_pAIN0_nGND 

AINP = AIN0 and AINN = GND.

ADS1115__MUX_pAIN1_nGND 

AINP = AIN1 and AINN = GND.

ADS1115__MUX_pAIN2_nGND 

AINP = AIN2 and AINN = GND.

ADS1115__MUX_pAIN3_nGND 

AINP = AIN3 and AINN = GND.

◆ ADS1115_polarity

Comparator Polarity enum for ADS1115.

Enumerator
ADS1115__POL_LOW 

Active Low.

ADS1115__POL_HIGH 

Active High.

◆ ADS1115_queue

Comparator Queue and Disable enum for ADS1115.

Enumerator
ADS1115__QUEUE_1CONV 

Assert after one conversion.

ADS1115__QUEUE_2CONV 

Assert after two conversions.

ADS1115__QUEUE_4CONV 

Assert after four conversions.

ADS1115__QUEUE_DISABLE 

Disable comparator.

◆ ADS1115_rate

Data rate enum for ADS1115.

Enumerator
ADS1115__SPS_8 

8 SPS (Samples Per Second)

ADS1115__SPS_16 

16 SPS

ADS1115__SPS_32 

32 SPS

ADS1115__SPS_64 

64 SPS

ADS1115__SPS_128 

128 SPS

ADS1115__SPS_250 

250 SPS

ADS1115__SPS_475 

475 SPS

ADS1115__SPS_860 

860 SPS

◆ ADS1115_reg

Register map enum of ADS1115.

Enumerator
ADS1115__CONVERSION 

Conversion register.

ADS1115__CONFIG 

Config register.

ADS1115__LOW_THRESH 

Lo_thresh register.

ADS1115__HI_THRESH 

Hi_thresh register.

Function Documentation

◆ ADS1115_Init()

FctERR ADS1115_Init ( const uint8_t idx,
I2C_HandleTypeDef *const hi2c,
const uint16_t devAddress )

Initialization for ADS1115 peripheral.

Parameters
[in]idx- ADS1115 index
[in]hi2c- pointer to ADS1115 I2C instance
[in]devAddress- ADS1115 device address
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ADS1115_Init_Single()

FctERR ADS1115_Init_Single ( void )

Initialization for ADS1115 peripheral.

Warning
In case multiple devices (defined by I2C_ADS1115_NB > 1), you shall use ADS1115_Init instead
Returns
FctERR - error code
Here is the call graph for this function:

◆ ADS1115_Read()

FctERR ADS1115_Read ( I2C_slave_t *const pSlave,
uint16_t * data,
const uint16_t addr )

I2C Read function for ADS1115.

Parameters
[in]pSlave- Pointer to I2C slave instance
[in,out]data- pointer to read to
[in]addr- Address to read from
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ADS1115_Write()

FctERR ADS1115_Write ( I2C_slave_t *const pSlave,
const uint16_t * data,
const uint16_t addr )

I2C Write function for ADS1115.

Parameters
[in]pSlave- Pointer to I2C slave instance
[in]data- pointer to write from
[in]addr- Address to write to
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function: