waveform4 2.0.0.0
Waveform 4 Click Driver

API for configuring and manipulating Waveform 4 Click driver. More...

Topics

 Waveform 4 Registers List
 List of registers of Waveform 4 Click driver.
 
 Waveform 4 Registers Settings
 Settings for registers of Waveform 4 Click driver.
 
 Waveform 4 MikroBUS Map
 MikroBUS pin mapping of Waveform 4 Click driver.
 

Functions

void waveform4_cfg_setup (waveform4_cfg_t *cfg)
 Waveform 4 configuration object setup function.
 
err_t waveform4_init (waveform4_t *ctx, waveform4_cfg_t *cfg)
 Waveform 4 initialization function.
 
err_t waveform4_default_cfg (waveform4_t *ctx)
 Waveform 4 default configuration function.
 
err_t waveform4_write_registers (waveform4_t *ctx, uint16_t reg, uint16_t *data_in, uint8_t len)
 Waveform 4 data writing function.
 
err_t waveform4_read_registers (waveform4_t *ctx, uint16_t reg, uint16_t *data_out, uint8_t len)
 Waveform 4 data reading function.
 
err_t waveform4_write_register (waveform4_t *ctx, uint16_t reg, uint16_t data_in)
 Waveform 4 single data writing function.
 
err_t waveform4_read_register (waveform4_t *ctx, uint16_t reg, uint16_t *data_out)
 Waveform 4 single data reading function.
 
void waveform4_set_rst_pin (waveform4_t *ctx, uint8_t state)
 Waveform 4 set RST pin function.
 
void waveform4_set_trg_pin (waveform4_t *ctx, uint8_t state)
 Waveform 4 set TRG pin function.
 
void waveform4_reset_registers (waveform4_t *ctx)
 Waveform 4 reset registers function.
 
err_t waveform4_start_pattern (waveform4_t *ctx)
 Waveform 4 start pattern function.
 
err_t waveform4_stop_pattern (waveform4_t *ctx)
 Waveform 4 stop pattern function.
 
err_t waveform4_update_settings (waveform4_t *ctx)
 Waveform 4 update settings function.
 
err_t waveform4_write_sram (waveform4_t *ctx, uint16_t address, uint16_t *data_in, uint16_t len)
 Waveform 4 write sram function.
 
err_t waveform4_read_sram (waveform4_t *ctx, uint16_t address, uint16_t *data_out, uint16_t len)
 Waveform 4 read sram function.
 
err_t waveform4_set_frequency (waveform4_t *ctx, uint32_t freq)
 Waveform 4 set frequency function.
 
err_t waveform4_set_gain (waveform4_t *ctx, uint8_t channel, float gain)
 Waveform 4 set gain function.
 
err_t waveform4_set_wave_output (waveform4_t *ctx, uint8_t channel, uint8_t wave)
 Waveform 4 set wave output function.
 

Detailed Description

API for configuring and manipulating Waveform 4 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

◆ waveform4_cfg_setup()

void waveform4_cfg_setup ( waveform4_cfg_t * cfg)

Waveform 4 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ waveform4_default_cfg()

err_t waveform4_default_cfg ( waveform4_t * ctx)

Waveform 4 default configuration function.

This function executes a default configuration of Waveform 4 click board.

Parameters
[in]ctx: Click context object. See waveform4_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.

◆ waveform4_init()

err_t waveform4_init ( waveform4_t * ctx,
waveform4_cfg_t * cfg )

Waveform 4 initialization function.

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

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

◆ waveform4_read_register()

err_t waveform4_read_register ( waveform4_t * ctx,
uint16_t reg,
uint16_t * data_out )

Waveform 4 single data reading function.

This function reads a single data byte from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See waveform4_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.

◆ waveform4_read_registers()

err_t waveform4_read_registers ( waveform4_t * ctx,
uint16_t reg,
uint16_t * data_out,
uint8_t len )

Waveform 4 data reading function.

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

Parameters
[in]ctx: Click context object. See waveform4_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.

◆ waveform4_read_sram()

err_t waveform4_read_sram ( waveform4_t * ctx,
uint16_t address,
uint16_t * data_out,
uint16_t len )

Waveform 4 read sram function.

This function reads a desired number of data bytes from the SRAM starting from the selected memory address.

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

◆ waveform4_reset_registers()

void waveform4_reset_registers ( waveform4_t * ctx)

Waveform 4 reset registers function.

This function resets all registers to default values.

Parameters
[in]ctx: Click context object. See waveform4_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ waveform4_set_frequency()

err_t waveform4_set_frequency ( waveform4_t * ctx,
uint32_t freq )

Waveform 4 set frequency function.

This function sets the sine and cosine (DDS) waves output frequency.

Parameters
[in]ctx: Click context object. See waveform4_t object definition for detailed explanation.
[in]freq: Frequency in Hz ( up to 125MHz ).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ waveform4_set_gain()

err_t waveform4_set_gain ( waveform4_t * ctx,
uint8_t channel,
float gain )

Waveform 4 set gain function.

This function sets the gain level of a desired channel.

Parameters
[in]ctx: Click context object. See waveform4_t object definition for detailed explanation.
[in]channel: Channel number [0,3].
[in]gain: Gain level [-2,2].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ waveform4_set_rst_pin()

void waveform4_set_rst_pin ( waveform4_t * ctx,
uint8_t state )

Waveform 4 set RST pin function.

This function sets the RST pin to a desired logic state.

Parameters
[in]ctx: Click context object. See waveform4_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ waveform4_set_trg_pin()

void waveform4_set_trg_pin ( waveform4_t * ctx,
uint8_t state )

Waveform 4 set TRG pin function.

This function sets the TRG pin to a desired logic state.

Parameters
[in]ctx: Click context object. See waveform4_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ waveform4_set_wave_output()

err_t waveform4_set_wave_output ( waveform4_t * ctx,
uint8_t channel,
uint8_t wave )

Waveform 4 set wave output function.

This function sets a desired output signal wave to the selected channel.

Parameters
[in]ctx: Click context object. See waveform4_t object definition for detailed explanation.
[in]channel: Channel number [0,3].
[in]wave:
  • 0 - Sine wave,
  • 1 - Cosine wave,
  • 2 - Triangle wave,
  • 3 - Positive sawtooth wave,
  • 4 - Negative sawtooth wave.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ waveform4_start_pattern()

err_t waveform4_start_pattern ( waveform4_t * ctx)

Waveform 4 start pattern function.

This function starts pattern generation by setting the RUN bit to 1 and the TRG pin low logic state.

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

◆ waveform4_stop_pattern()

err_t waveform4_stop_pattern ( waveform4_t * ctx)

Waveform 4 stop pattern function.

This function stops pattern generation by setting the RUN bit to 0 and the TRG pin high logic state.

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

◆ waveform4_update_settings()

err_t waveform4_update_settings ( waveform4_t * ctx)

Waveform 4 update settings function.

This function updates all SPI setting with new configuration by setting RAMUPDATE bit to 1.

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

◆ waveform4_write_register()

err_t waveform4_write_register ( waveform4_t * ctx,
uint16_t reg,
uint16_t data_in )

Waveform 4 single data writing function.

This function writes a single data byte to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See waveform4_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.

◆ waveform4_write_registers()

err_t waveform4_write_registers ( waveform4_t * ctx,
uint16_t reg,
uint16_t * data_in,
uint8_t len )

Waveform 4 data writing function.

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

Parameters
[in]ctx: Click context object. See waveform4_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.

◆ waveform4_write_sram()

err_t waveform4_write_sram ( waveform4_t * ctx,
uint16_t address,
uint16_t * data_in,
uint16_t len )

Waveform 4 write sram function.

This function writes a desired number of data bytes to the SRAM starting from the selected memory address.

Parameters
[in]ctx: Click context object. See waveform4_t object definition for detailed explanation.
[in]address: SRAM memory address [0x6000,0x6FFF].
[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.