dac18  2.1.0.0
Modules | Functions
DAC 18 Click Driver

API for configuring and manipulating DAC 18 Click driver. More...

Modules

 DAC 18 Registers List
 List of registers of DAC 18 Click driver.
 
 DAC 18 Registers Settings
 Settings for registers of DAC 18 Click driver.
 
 DAC 18 MikroBUS Map
 MikroBUS pin mapping of DAC 18 Click driver.
 

Functions

void dac18_cfg_setup (dac18_cfg_t *cfg)
 DAC 18 configuration object setup function. More...
 
err_t dac18_init (dac18_t *ctx, dac18_cfg_t *cfg)
 DAC 18 initialization function. More...
 
err_t dac18_default_cfg (dac18_t *ctx)
 DAC 18 default configuration function. More...
 
err_t dac18_generic_write (dac18_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DAC 18 I2C writing function. More...
 
err_t dac18_generic_read (dac18_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DAC 18 I2C reading function. More...
 
err_t dac18_register_write (dac18_t *ctx, uint8_t reg, uint16_t data_in)
 DAC 18 register writing function. More...
 
err_t dac18_register_read (dac18_t *ctx, uint8_t reg, uint16_t *data_out)
 DAC 18 register reading function. More...
 
err_t dac18_cfg_pwm_out (dac18_t *ctx, uint8_t f_sel, uint8_t c_step, uint8_t t_step)
 DAC 18 PWM OUT0 configuration function. More...
 
err_t dac18_set_dac_code (dac18_t *ctx, uint16_t max_dc, uint16_t min_dc)
 DAC 18 set DAC code function. More...
 
err_t dac18_set_debounce_delay (dac18_t *ctx, float delay_ms)
 DAC 18 set debounce delay function. More...
 
void dac18_set_mode (dac18_t *ctx, uint8_t mode)
 DAC 18 set operation mode function. More...
 
uint8_t dac18_get_gp0 (dac18_t *ctx)
 DAC 18 get GP0 pin state function. More...
 
uint8_t dac18_get_gp1 (dac18_t *ctx)
 DAC 18 get GP1 pin state function. More...
 
uint8_t dac18_get_gp2 (dac18_t *ctx)
 DAC 18 get GP2 pin state function. More...
 
void dac18_get_gpi_status (dac18_t *ctx, uint8_t *gpi_status)
 DAC 18 get GPI status function. More...
 

Detailed Description

API for configuring and manipulating DAC 18 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ dac18_cfg_pwm_out()

err_t dac18_cfg_pwm_out ( dac18_t ctx,
uint8_t  f_sel,
uint8_t  c_step,
uint8_t  t_step 
)

DAC 18 PWM OUT0 configuration function.

This function configures PWM output (OUT0) for the function generator by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]f_sel: Function select (sawtooth or triangular waveform).
[in]c_step: Code step [0x00-0x07].
[in]t_step: Time step [0x00-0x0F].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac18_cfg_setup()

void dac18_cfg_setup ( dac18_cfg_t cfg)

DAC 18 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See dac18_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ dac18_default_cfg()

err_t dac18_default_cfg ( dac18_t ctx)

DAC 18 default configuration function.

This function executes a default configuration of DAC 18 click board.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ dac18_generic_read()

err_t dac18_generic_read ( dac18_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

DAC 18 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac18_generic_write()

err_t dac18_generic_write ( dac18_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

DAC 18 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac18_get_gp0()

uint8_t dac18_get_gp0 ( dac18_t ctx)

DAC 18 get GP0 pin state function.

This function gets states of the GP0 pin.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ dac18_get_gp1()

uint8_t dac18_get_gp1 ( dac18_t ctx)

DAC 18 get GP1 pin state function.

This function gets states of the GP1 pin.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ dac18_get_gp2()

uint8_t dac18_get_gp2 ( dac18_t ctx)

DAC 18 get GP2 pin state function.

This function gets states of the GP2 pin.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ dac18_get_gpi_status()

void dac18_get_gpi_status ( dac18_t ctx,
uint8_t *  gpi_status 
)

DAC 18 get GPI status function.

This function gets GPI status by reading the states of the GP0, GP1 and GP2 pins.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]gpi_status: GPI status [0-7].
Returns
Nothing.
Note
None.

◆ dac18_init()

err_t dac18_init ( dac18_t ctx,
dac18_cfg_t cfg 
)

DAC 18 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See dac18_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac18_register_read()

err_t dac18_register_read ( dac18_t ctx,
uint8_t  reg,
uint16_t *  data_out 
)

DAC 18 register reading function.

This function reads a 16-bit starting from the selected register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac18_register_write()

err_t dac18_register_write ( dac18_t ctx,
uint8_t  reg,
uint16_t  data_in 
)

DAC 18 register writing function.

This function writes a 16-bit data to the selected register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac18_set_dac_code()

err_t dac18_set_dac_code ( dac18_t ctx,
uint16_t  max_dc,
uint16_t  min_dc 
)

DAC 18 set DAC code function.

This function sets min and max DAC code for the function generator by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]f_sel: Function select (sawtooth or triangular waveform).
[in]max_dc: Maximum DAC code for the function generator.
[in]min_dc: Minimum DAC code for the function generator.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac18_set_debounce_delay()

err_t dac18_set_debounce_delay ( dac18_t ctx,
float  delay_ms 
)

DAC 18 set debounce delay function.

This function sets the desired debounce delay y for the GPI pins by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]delay_ms: Debounce delay in millisecond [0ms-10485.6ms].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac18_set_mode()

void dac18_set_mode ( dac18_t ctx,
uint8_t  mode 
)

DAC 18 set operation mode function.

This function selects between programming and standalone modes by toggling the digital output state of the MOD pin.

Parameters
[in]ctx: Click context object. See dac18_t object definition for detailed explanation.
[in]mode:
  • 0 - Configuration mode,
  • 1 - Standalone mode.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.