Driver for the Guestgood GP8xxx I2C DACs. More...
Driver for the Guestgood GP8xxx I2C DACs.
The Guestgood GP8xxx I2C DACs are a series of digital-to-analog voltage (VDAC) and current (IDAC) converters. The driver supports a range of converters, each with different number of channels and output ranges.
The supported DACs are:
Storing the output settings into internal memory is not supported by this driver, because the driver will always initialize to a known state.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
Files | |
| file | gp8xxx_constants.h |
| Internal addresses, registers and constants. | |
| file | gp8xxx_info.h |
| Definitions of the Guestgood GP8xxx I2C DACs. | |
| file | gp8xxx_params.h |
| Default configuration for the Guestgood GP8xxx I2C DACs. | |
| file | gp8xxx.h |
Data Structures | |
| struct | gp8xxx_params_t |
| Device initialization parameters. More... | |
| struct | gp8xxx_saul_params_t |
| SAUL device initialization parameters. More... | |
| struct | gp8xxx_t |
| Device descriptor for the driver. More... | |
| struct | gp8xxx_saul_t |
| SAUL device descriptor for the driver. More... | |
Enumerations | |
| enum | gp8xxx_channel_t { GP8XXX_CHANNEL_0 = 0 , GP8XXX_CHANNEL_1 = 1 , GP8XXX_CHANNEL_ALL = 2 } |
| Compile time macros to enable/disable features. More... | |
| enum | gp8xxx_output_range_t { GP8XXX_OUTPUT_RANGE_2_5V = 2500 , GP8XXX_OUTPUT_RANGE_VCC = 3300 , GP8XXX_OUTPUT_RANGE_5V = 5000 , GP8XXX_OUTPUT_RANGE_10V = 10000 , GP8XXX_OUTPUT_RANGE_25_MA = 25000 } |
| Output range values. More... | |
Functions | |
| int | gp8xxx_init (gp8xxx_t *dev, const gp8xxx_params_t *params) |
| Initialize the given device. | |
| int | gp8xxx_set_dac (gp8xxx_t *dev, gp8xxx_channel_t channel, uint16_t value) |
| Set the DAC value. | |
| int | gp8xxx_set_voltage_range (gp8xxx_t *dev, gp8xxx_output_range_t value) |
| Set the output range. | |
| int | gp8xxx_set_voltage (gp8xxx_t *dev, gp8xxx_channel_t channel, uint16_t voltage) |
| Set the voltage. | |
| void | gp8xxx_set_current_calibration (gp8xxx_t *dev, uint16_t calibration_4ma, uint16_t calibration_20ma) |
| Set the current calibration values. | |
| int | gp8xxx_set_current (gp8xxx_t *dev, gp8xxx_channel_t channel, uint16_t current) |
| Set the current. | |
| enum gp8xxx_channel_t |
Compile time macros to enable/disable features.
VDAC or IDAC support is only enabled if a module is selected that supports it. A minor code size increase is expected when both a VDAC and IDAC module are selected.
Channel values
| Enumerator | |
|---|---|
| GP8XXX_CHANNEL_0 | Channel 0. |
| GP8XXX_CHANNEL_1 | Channel 1. |
| GP8XXX_CHANNEL_ALL | All channels. |
| int gp8xxx_init | ( | gp8xxx_t * | dev, |
| const gp8xxx_params_t * | params ) |
Initialize the given device.
The driver will initialize will initialize all channels to a known state.
| [in,out] | dev | Device descriptor of the driver |
| [in] | params | Initialization parameters |
| 0 | on success |
| -ENODEV | if no device is found |
| int gp8xxx_set_current | ( | gp8xxx_t * | dev, |
| gp8xxx_channel_t | channel, | ||
| uint16_t | current ) |
Set the current.
| [in] | dev | Device descriptor of the driver |
| [in] | channel | Channel to set |
| [in] | current | Current to set (in uA) |
| 0 | on success |
| -ERANGE | if value is out of range |
| -EIO | on I2C error |
| void gp8xxx_set_current_calibration | ( | gp8xxx_t * | dev, |
| uint16_t | calibration_4ma, | ||
| uint16_t | calibration_20ma ) |
Set the current calibration values.
When both calibration values are set, the driver can more precisely set the current between 4 mA and 20 mA. If both values are set to 0, the driver will default to a linear interpolation between 4 mA and 20 mA.
The value of calibration_4ma must be smaller than calibration_20ma and both values must be between 0 and the maximum resolution of the DAC.
| [in] | dev | Device descriptor of the driver |
| [in] | calibration_4ma | ADC value for 4 mA |
| [in] | calibration_20ma | ADC value for 20 mA |
| int gp8xxx_set_dac | ( | gp8xxx_t * | dev, |
| gp8xxx_channel_t | channel, | ||
| uint16_t | value ) |
Set the DAC value.
| [in] | dev | Device descriptor of the driver |
| [in] | channel | Channel to set |
| [in] | value | Value to set (between 0 and maximum resolution) |
| 0 | on success |
| -ERANGE | if value is out of range |
| -EIO | on I2C error |
| int gp8xxx_set_voltage | ( | gp8xxx_t * | dev, |
| gp8xxx_channel_t | channel, | ||
| uint16_t | voltage ) |
Set the voltage.
| [in] | dev | Device descriptor of the driver |
| [in] | channel | Channel to set |
| [in] | voltage | Voltage to set (in mV) |
| 0 | on success |
| -ERANGE | if value is out of range |
| -EIO | on I2C error |
| int gp8xxx_set_voltage_range | ( | gp8xxx_t * | dev, |
| gp8xxx_output_range_t | value ) |
Set the output range.
| [in] | dev | Device descriptor of the driver |
| [in] | value | Output range to set |
| 0 | on success |
| -EIO | on I2C error |