LibDriver ADS1115
Loading...
Searching...
No Matches
ads1115 base driver function

ads1115 base driver modules More...

Collaboration diagram for ads1115 base driver function:

Data Structures

struct  ads1115_handle_s
 ads1115 handle structure definition More...
struct  ads1115_info_s
 ads1115 information structure definition More...

Typedefs

typedef struct ads1115_handle_s ads1115_handle_t
 ads1115 handle structure definition
typedef struct ads1115_info_s ads1115_info_t
 ads1115 information structure definition

Enumerations

enum  ads1115_address_t { ADS1115_ADDR_GND = 0x00 , ADS1115_ADDR_VCC = 0x01 , ADS1115_ADDR_SDA = 0x02 , ADS1115_ADDR_SCL = 0x03 }
 ads1115 address enumeration definition More...
enum  ads1115_bool_t { ADS1115_BOOL_FALSE = 0x00 , ADS1115_BOOL_TRUE = 0x01 }
 ads1115 bool enumeration definition More...
enum  ads1115_range_t {
  ADS1115_RANGE_6P144V = 0x00 , ADS1115_RANGE_4P096V = 0x01 , ADS1115_RANGE_2P048V = 0x02 , ADS1115_RANGE_1P024V = 0x03 ,
  ADS1115_RANGE_0P512V = 0x04 , ADS1115_RANGE_0P256V = 0x05
}
 ads1115 range enumeration definition More...
enum  ads1115_rate_t {
  ADS1115_RATE_8SPS = 0x00 , ADS1115_RATE_16SPS = 0x01 , ADS1115_RATE_32SPS = 0x02 , ADS1115_RATE_64SPS = 0x03 ,
  ADS1115_RATE_128SPS = 0x04 , ADS1115_RATE_250SPS = 0x05 , ADS1115_RATE_475SPS = 0x06 , ADS1115_RATE_860SPS = 0x07
}
 ads1115 channel rate enumeration definition More...
enum  ads1115_channel_t {
  ADS1115_CHANNEL_AIN0_AIN1 = 0x00 , ADS1115_CHANNEL_AIN0_AIN3 = 0x01 , ADS1115_CHANNEL_AIN1_AIN3 = 0x02 , ADS1115_CHANNEL_AIN2_AIN3 = 0x03 ,
  ADS1115_CHANNEL_AIN0_GND = 0x04 , ADS1115_CHANNEL_AIN1_GND = 0x05 , ADS1115_CHANNEL_AIN2_GND = 0x06 , ADS1115_CHANNEL_AIN3_GND = 0x07
}
 ads1115 channel enumeration definition More...

Functions

uint8_t ads1115_info (ads1115_info_t *info)
 get chip's information
uint8_t ads1115_set_addr_pin (ads1115_handle_t *handle, ads1115_address_t addr_pin)
 set the iic address pin
uint8_t ads1115_get_addr_pin (ads1115_handle_t *handle, ads1115_address_t *addr_pin)
 get the iic address pin
uint8_t ads1115_init (ads1115_handle_t *handle)
 initialize the chip
uint8_t ads1115_deinit (ads1115_handle_t *handle)
 close the chip
uint8_t ads1115_single_read (ads1115_handle_t *handle, int16_t *raw, float *v)
 read data from the chip once
uint8_t ads1115_start_continuous_read (ads1115_handle_t *handle)
 start the chip reading
uint8_t ads1115_stop_continuous_read (ads1115_handle_t *handle)
 stop the chip reading
uint8_t ads1115_continuous_read (ads1115_handle_t *handle, int16_t *raw, float *v)
 read data from the chip continuously
uint8_t ads1115_set_channel (ads1115_handle_t *handle, ads1115_channel_t channel)
 set the adc channel
uint8_t ads1115_get_channel (ads1115_handle_t *handle, ads1115_channel_t *channel)
 get the adc channel
uint8_t ads1115_set_range (ads1115_handle_t *handle, ads1115_range_t range)
 set the adc range
uint8_t ads1115_get_range (ads1115_handle_t *handle, ads1115_range_t *range)
 get the adc range
uint8_t ads1115_set_rate (ads1115_handle_t *handle, ads1115_rate_t rate)
 set the sample rate
uint8_t ads1115_get_rate (ads1115_handle_t *handle, ads1115_rate_t *rate)
 get the sample rate

Detailed Description

ads1115 base driver modules

Typedef Documentation

◆ ads1115_handle_t

ads1115 handle structure definition

◆ ads1115_info_t

ads1115 information structure definition

Enumeration Type Documentation

◆ ads1115_address_t

ads1115 address enumeration definition

Enumerator
ADS1115_ADDR_GND 

ADDR pin connected to GND

ADS1115_ADDR_VCC 

ADDR pin connected to VCC

ADS1115_ADDR_SDA 

ADDR pin connected to SDA

ADS1115_ADDR_SCL 

ADDR pin connected to SCL

Definition at line 63 of file driver_ads1115.h.

◆ ads1115_bool_t

ads1115 bool enumeration definition

Enumerator
ADS1115_BOOL_FALSE 

disable function

ADS1115_BOOL_TRUE 

enable function

Definition at line 74 of file driver_ads1115.h.

◆ ads1115_channel_t

ads1115 channel enumeration definition

Enumerator
ADS1115_CHANNEL_AIN0_AIN1 

AIN0 and AIN1 pins

ADS1115_CHANNEL_AIN0_AIN3 

AIN0 and AIN3 pins

ADS1115_CHANNEL_AIN1_AIN3 

AIN1 and AIN3 pins

ADS1115_CHANNEL_AIN2_AIN3 

AIN2 and AIN3 pins

ADS1115_CHANNEL_AIN0_GND 

AIN0 and GND pins

ADS1115_CHANNEL_AIN1_GND 

AIN1 and GND pins

ADS1115_CHANNEL_AIN2_GND 

AIN2 and GND pins

ADS1115_CHANNEL_AIN3_GND 

AIN3 and GND pins

Definition at line 111 of file driver_ads1115.h.

◆ ads1115_range_t

ads1115 range enumeration definition

Enumerator
ADS1115_RANGE_6P144V 

6.144V range

ADS1115_RANGE_4P096V 

4.096V range

ADS1115_RANGE_2P048V 

2.048V range

ADS1115_RANGE_1P024V 

1.024V range

ADS1115_RANGE_0P512V 

0.512V range

ADS1115_RANGE_0P256V 

0.256V range

Definition at line 83 of file driver_ads1115.h.

◆ ads1115_rate_t

ads1115 channel rate enumeration definition

Enumerator
ADS1115_RATE_8SPS 

8 sample per second

ADS1115_RATE_16SPS 

16 sample per second

ADS1115_RATE_32SPS 

32 sample per second

ADS1115_RATE_64SPS 

64 sample per second

ADS1115_RATE_128SPS 

128 sample per second

ADS1115_RATE_250SPS 

250 sample per second

ADS1115_RATE_475SPS 

475 sample per second

ADS1115_RATE_860SPS 

860 sample per second

Definition at line 96 of file driver_ads1115.h.

Function Documentation

◆ ads1115_continuous_read()

uint8_t ads1115_continuous_read ( ads1115_handle_t * handle,
int16_t * raw,
float * v )

read data from the chip continuously

Parameters
[in]*handlepointer to an ads1115 handle structure
[out]*rawpointer to a raw adc buffer
[out]*vpointer to a converted adc buffer
Returns
status code
  • 0 success
  • 1 continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
this function can be used only after run ads1115_start_continuous_read and can be stopped by ads1115_stop_continuous_read

Definition at line 936 of file driver_ads1115.c.

◆ ads1115_deinit()

uint8_t ads1115_deinit ( ads1115_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an ads1115 handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 194 of file driver_ads1115.c.

◆ ads1115_get_addr_pin()

uint8_t ads1115_get_addr_pin ( ads1115_handle_t * handle,
ads1115_address_t * addr_pin )

get the iic address pin

Parameters
[in]*handlepointer to an ads1115 handle structure
[out]*addr_pinpointer to a chip iic address pin buffer
Returns
status code
  • 0 success
  • 1 get addr pin failed
  • 2 handle is NULL
Note
none

Definition at line 781 of file driver_ads1115.c.

◆ ads1115_get_channel()

uint8_t ads1115_get_channel ( ads1115_handle_t * handle,
ads1115_channel_t * channel )

get the adc channel

Parameters
[in]*handlepointer to an ads1115 handle structure
[out]*channelpointer to a channel buffer
Returns
status code
  • 0 success
  • 1 get channel failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 292 of file driver_ads1115.c.

◆ ads1115_get_range()

uint8_t ads1115_get_range ( ads1115_handle_t * handle,
ads1115_range_t * range )

get the adc range

Parameters
[in]*handlepointer to an ads1115 handle structure
[out]*rangepointer to a voltage range buffer
Returns
status code
  • 0 success
  • 1 get range failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 374 of file driver_ads1115.c.

◆ ads1115_get_rate()

uint8_t ads1115_get_rate ( ads1115_handle_t * handle,
ads1115_rate_t * rate )

get the sample rate

Parameters
[in]*handlepointer to an ads1115 handle structure
[out]*ratepointer to an adc sample rate buffer
Returns
status code
  • 0 success
  • 1 get rate failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 620 of file driver_ads1115.c.

◆ ads1115_info()

uint8_t ads1115_info ( ads1115_info_t * info)

get chip's information

Parameters
[out]*infopointer to an ads1115 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 1445 of file driver_ads1115.c.

◆ ads1115_init()

uint8_t ads1115_init ( ads1115_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an ads1115 handle structure
Returns
status code
  • 0 success
  • 1 iic initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 131 of file driver_ads1115.c.

◆ ads1115_set_addr_pin()

uint8_t ads1115_set_addr_pin ( ads1115_handle_t * handle,
ads1115_address_t addr_pin )

set the iic address pin

Parameters
[in]*handlepointer to an ads1115 handle structure
[in]addr_piniic address pin
Returns
status code
  • 0 success
  • 1 set addr pin failed
  • 2 handle is NULL
Note
none

Definition at line 738 of file driver_ads1115.c.

◆ ads1115_set_channel()

uint8_t ads1115_set_channel ( ads1115_handle_t * handle,
ads1115_channel_t channel )

set the adc channel

Parameters
[in]*handlepointer to an ads1115 handle structure
[in]channeladc channel
Returns
status code
  • 0 success
  • 1 set channel failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 247 of file driver_ads1115.c.

◆ ads1115_set_range()

uint8_t ads1115_set_range ( ads1115_handle_t * handle,
ads1115_range_t range )

set the adc range

Parameters
[in]*handlepointer to an ads1115 handle structure
[in]rangeadc max voltage range
Returns
status code
  • 0 success
  • 1 set range failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 329 of file driver_ads1115.c.

◆ ads1115_set_rate()

uint8_t ads1115_set_rate ( ads1115_handle_t * handle,
ads1115_rate_t rate )

set the sample rate

Parameters
[in]*handlepointer to an ads1115 handle structure
[in]rateadc sample rate
Returns
status code
  • 0 success
  • 1 set rate failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 575 of file driver_ads1115.c.

◆ ads1115_single_read()

uint8_t ads1115_single_read ( ads1115_handle_t * handle,
int16_t * raw,
float * v )

read data from the chip once

Parameters
[in]*handlepointer to an ads1115 handle structure
[out]*rawpointer to a raw adc buffer
[out]*vpointer to a converted adc buffer
Returns
status code
  • 0 success
  • 1 single read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 826 of file driver_ads1115.c.

◆ ads1115_start_continuous_read()

uint8_t ads1115_start_continuous_read ( ads1115_handle_t * handle)

start the chip reading

Parameters
[in]*handlepointer to an ads1115 handle structure
Returns
status code
  • 0 success
  • 1 start continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1010 of file driver_ads1115.c.

◆ ads1115_stop_continuous_read()

uint8_t ads1115_stop_continuous_read ( ads1115_handle_t * handle)

stop the chip reading

Parameters
[in]*handlepointer to an ads1115 handle structure
Returns
status code
  • 0 success
  • 1 stop continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1053 of file driver_ads1115.c.