ADS1115 ADC driver.
More...
|
#define | ALRT_EVENT 0U |
| Alert event ID used for soft interrupt handling.
|
|
#define | ADS1115_I2C_PORT I2C_PORT_1 |
| Default I2C port used by the ADS1115.
|
|
ADS1115 ADC driver.
◆ ADS1115_Address
I2C Address selection based on ADDR pin connection.
Enumerator |
---|
ADS1115_ADDR_GND | ADDR pin connected to GND
|
ADS1115_ADDR_VDD | ADDR pin connected to VDD
|
ADS1115_ADDR_SDA | ADDR pin connected to SDA
|
ADS1115_ADDR_SCL | ADDR pin connected to SCL
|
◆ ADS1115_Channel
ADS1115 single-ended input channels.
Enumerator |
---|
ADS1115_CHANNEL_0 | Input channel AIN0
|
ADS1115_CHANNEL_1 | Input channel AIN1
|
ADS1115_CHANNEL_2 | Input channel AIN2
|
ADS1115_CHANNEL_3 | Input channel AIN3
|
◆ ADS1115_Reg
Register map for the ADS1115.
Enumerator |
---|
ADS1115_REG_CONVERSION | Conversion result register
|
ADS1115_REG_CONFIG | Configuration register
|
ADS1115_REG_LO_THRESH | Low threshold register for comparator
|
ADS1115_REG_HI_THRESH | High threshold register for comparator
|
◆ ads1115_init()
Initializes the ADS1115 on the I2C bus with an optional ALERT/RDY pin.
- Parameters
-
config | Pointer to the ADS1115_Config to populate |
i2c_addr | I2C address of the device |
ready_pin | Pointer to GPIO address of the ALERT/RDY pin (can be NULL) |
- Returns
- STATUS_CODE_OK if initialization succeeds STATUS_CODE_INVALID_ARGS if config or address is invalid STATUS_CODE_INTERNAL_ERROR on I2C failure
◆ ads1115_read_converted()
Reads and converts the ADC value from the specified channel into a voltage.
Conversion depends on the ADS1115's internal reference and configuration.
- Parameters
-
config | Pointer to the ADS1115 configuration |
channel | Input channel to read from |
reading | Pointer to store the converted voltage (in volts) |
- Returns
- STATUS_CODE_OK if successful STATUS_CODE_INVALID_ARGS if any parameter is invalid STATUS_CODE_INTERNAL_ERROR on I2C failure
◆ ads1115_read_raw()
Reads the raw ADC value from the specified channel.
- Parameters
-
config | Pointer to the ADS1115 configuration |
channel | Input channel to read from |
reading | Pointer to store the raw 16-bit ADC result |
- Returns
- STATUS_CODE_OK if successful STATUS_CODE_INVALID_ARGS if any parameter is invalid STATUS_CODE_INTERNAL_ERROR on I2C failure
◆ ads1115_select_channel()
Selects the active ADC channel on the ADS1115.
Reconfigures the ADC for single-ended input on the selected channel.
- Parameters
-
config | Pointer to the ADS1115 configuration |
channel | Input channel to read from (AIN0–AIN3) |
- Returns
- STATUS_CODE_OK if successful STATUS_CODE_INVALID_ARGS if channel or config is invalid