Loading...
Searching...
No Matches

Driver for the Guestgood GP8xxx I2C DACs. More...

Detailed Description

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.
 

Enumeration Type Documentation

◆ 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.

Definition at line 65 of file gp8xxx.h.

◆ gp8xxx_output_range_t

Output range values.

Enumerator
GP8XXX_OUTPUT_RANGE_2_5V 

0-2.5 V output range

GP8XXX_OUTPUT_RANGE_VCC 

0-VCC V output range (VCC fixed to 3V3)

GP8XXX_OUTPUT_RANGE_5V 

0-5 V output range

GP8XXX_OUTPUT_RANGE_10V 

0-10 V output range

GP8XXX_OUTPUT_RANGE_25_MA 

0-25 mA output range

Definition at line 74 of file gp8xxx.h.

Function Documentation

◆ gp8xxx_init()

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.

Parameters
[in,out]devDevice descriptor of the driver
[in]paramsInitialization parameters
Return values
0on success
-ENODEVif no device is found

◆ gp8xxx_set_current()

int gp8xxx_set_current ( gp8xxx_t * dev,
gp8xxx_channel_t channel,
uint16_t current )

Set the current.

Parameters
[in]devDevice descriptor of the driver
[in]channelChannel to set
[in]currentCurrent to set (in uA)
Return values
0on success
-ERANGEif value is out of range
-EIOon I2C error

◆ gp8xxx_set_current_calibration()

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.

Parameters
[in]devDevice descriptor of the driver
[in]calibration_4maADC value for 4 mA
[in]calibration_20maADC value for 20 mA

◆ gp8xxx_set_dac()

int gp8xxx_set_dac ( gp8xxx_t * dev,
gp8xxx_channel_t channel,
uint16_t value )

Set the DAC value.

Parameters
[in]devDevice descriptor of the driver
[in]channelChannel to set
[in]valueValue to set (between 0 and maximum resolution)
Return values
0on success
-ERANGEif value is out of range
-EIOon I2C error

◆ gp8xxx_set_voltage()

int gp8xxx_set_voltage ( gp8xxx_t * dev,
gp8xxx_channel_t channel,
uint16_t voltage )

Set the voltage.

Parameters
[in]devDevice descriptor of the driver
[in]channelChannel to set
[in]voltageVoltage to set (in mV)
Return values
0on success
-ERANGEif value is out of range
-EIOon I2C error

◆ gp8xxx_set_voltage_range()

int gp8xxx_set_voltage_range ( gp8xxx_t * dev,
gp8xxx_output_range_t value )

Set the output range.

Parameters
[in]devDevice descriptor of the driver
[in]valueOutput range to set
Return values
0on success
-EIOon I2C error