waveform4 2.0.0.0
waveform4.h File Reference

This file contains API for Waveform 4 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  waveform4_t
 Waveform 4 Click context object. More...
 
struct  waveform4_cfg_t
 Waveform 4 Click configuration object. More...
 

Macros

#define WAVEFORM4_REG_SPI_CONFIG   0x0000
 Waveform 4 register map.
 
#define WAVEFORM4_REG_POWER_CONFIG   0x0001
 
#define WAVEFORM4_REG_CLOCK_CONFIG   0x0002
 
#define WAVEFORM4_REG_REF_ADJ   0x0003
 
#define WAVEFORM4_REG_DAC4_AGAIN   0x0004
 
#define WAVEFORM4_REG_DAC3_AGAIN   0x0005
 
#define WAVEFORM4_REG_DAC2_AGAIN   0x0006
 
#define WAVEFORM4_REG_DAC1_AGAIN   0x0007
 
#define WAVEFORM4_REG_DACX_RANGE   0x0008
 
#define WAVEFORM4_REG_DAC4_RSET   0x0009
 
#define WAVEFORM4_REG_DAC3_RSET   0x000A
 
#define WAVEFORM4_REG_DAC2_RSET   0x000B
 
#define WAVEFORM4_REG_DAC1_RSET   0x000C
 
#define WAVEFORM4_REG_CAL_CONFIG   0x000D
 
#define WAVEFORM4_REG_COMP_OFFSET   0x000E
 
#define WAVEFORM4_REG_RAM_UPDATE   0x001D
 
#define WAVEFORM4_REG_PAT_STATUS   0x001E
 
#define WAVEFORM4_REG_PAT_TYPE   0x001F
 
#define WAVEFORM4_REG_PATTERN_DLY   0x0020
 
#define WAVEFORM4_REG_DAC4_DOF   0x0022
 
#define WAVEFORM4_REG_DAC3_DOF   0x0023
 
#define WAVEFORM4_REG_DAC2_DOF   0x0024
 
#define WAVEFORM4_REG_DAC1_DOF   0x0025
 
#define WAVEFORM4_REG_WAV43_CONFIG   0x0026
 
#define WAVEFORM4_REG_WAV21_CONFIG   0x0027
 
#define WAVEFORM4_REG_PAT_TIMEBASE   0x0028
 
#define WAVEFORM4_REG_PAT_PERIOD   0x0029
 
#define WAVEFORM4_REG_DAC43_PATX   0x002A
 
#define WAVEFORM4_REG_DAC21_PATX   0x002B
 
#define WAVEFORM4_REG_DOUT_START_DLY   0x002C
 
#define WAVEFORM4_REG_DOUT_CONFIG   0x002D
 
#define WAVEFORM4_REG_DAC4_CST   0x002E
 
#define WAVEFORM4_REG_DAC3_CST   0x002F
 
#define WAVEFORM4_REG_DAC2_CST   0x0030
 
#define WAVEFORM4_REG_DAC1_CST   0x0031
 
#define WAVEFORM4_REG_DAC4_DGAIN   0x0032
 
#define WAVEFORM4_REG_DAC3_DGAIN   0x0033
 
#define WAVEFORM4_REG_DAC2_DGAIN   0x0034
 
#define WAVEFORM4_REG_DAC1_DGAIN   0x0035
 
#define WAVEFORM4_REG_SAW43_CONFIG   0x0036
 
#define WAVEFORM4_REG_SAW21_CONFIG   0x0037
 
#define WAVEFORM4_REG_DDS_TW32   0x003E
 
#define WAVEFORM4_REG_DDS_TW1   0x003F
 
#define WAVEFORM4_REG_DDS4_PW   0x0040
 
#define WAVEFORM4_REG_DDS3_PW   0x0041
 
#define WAVEFORM4_REG_DDS2_PW   0x0042
 
#define WAVEFORM4_REG_DDS1_PW   0x0043
 
#define WAVEFORM4_REG_TRIG_TW_SEL   0x0044
 
#define WAVEFORM4_REG_DDSX_CONFIG   0x0045
 
#define WAVEFORM4_REG_TW_RAM_CONFIG   0x0047
 
#define WAVEFORM4_REG_START_DLY4   0x0050
 
#define WAVEFORM4_REG_START_ADDR4   0x0051
 
#define WAVEFORM4_REG_STOP_ADDR4   0x0052
 
#define WAVEFORM4_REG_DDS_CYC4   0x0053
 
#define WAVEFORM4_REG_START_DLY3   0x0054
 
#define WAVEFORM4_REG_START_ADDR3   0x0055
 
#define WAVEFORM4_REG_STOP_ADDR3   0x0056
 
#define WAVEFORM4_REG_DDS_CYC3   0x0057
 
#define WAVEFORM4_REG_START_DLY2   0x0058
 
#define WAVEFORM4_REG_START_ADDR2   0x0059
 
#define WAVEFORM4_REG_STOP_ADDR2   0x005A
 
#define WAVEFORM4_REG_DDS_CYC2   0x005B
 
#define WAVEFORM4_REG_START_DLY1   0x005C
 
#define WAVEFORM4_REG_START_ADDR1   0x005D
 
#define WAVEFORM4_REG_STOP_ADDR1   0x005E
 
#define WAVEFORM4_REG_DDS_CYC1   0x005F
 
#define WAVEFORM4_REG_CFG_ERROR   0x0060
 
#define WAVEFORM4_SRAM_ADDRESS_MIN   0x6000
 
#define WAVEFORM4_SRAM_ADDRESS_MAX   0x6FFF
 
#define WAVEFORM4_WAV_CFG_PRESTORE_CST   0x00
 Waveform 4 wave config macros.
 
#define WAVEFORM4_WAV_CFG_PRESTORE_SAWTOOTH   0x10
 
#define WAVEFORM4_WAV_CFG_PRESTORE_PSEUDO   0x20
 
#define WAVEFORM4_WAV_CFG_PRESTORE_DDS   0x30
 
#define WAVEFORM4_WAV_CFG_WAVE_FROM_RAM   0x00
 
#define WAVEFORM4_WAV_CFG_WAVE_PRESTORED   0x01
 
#define WAVEFORM4_WAV_CFG_WAVE_PRESTORED_DELAY   0x02
 
#define WAVEFORM4_WAV_CFG_WAVE_PRESTORED_RAM   0x03
 
#define WAVEFORM4_DDSX_CFG_ENABLE_COSINE   0x08
 
#define WAVEFORM4_SAW_CFG_RAMP_UP   0x00
 
#define WAVEFORM4_SAW_CFG_RAMP_DOWN   0x01
 
#define WAVEFORM4_SAW_CFG_TRIANGLE   0x02
 
#define WAVEFORM4_SAW_CFG_NO_WAVE   0x03
 
#define WAVEFORM4_SAW_CFG_STEP_1   0x04
 
#define WAVEFORM4_DEFAULT_GAIN   0.5
 Waveform 4 default settings macros.
 
#define WAVEFORM4_DEFAULT_FREQUENCY   100000
 
#define WAVEFORM4_UPDATE_SETTINGS   0x01
 Waveform 4 ram update and pat status register macros.
 
#define WAVEFORM4_MEM_ACCESS_ENABLE   0x04
 
#define WAVEFORM4_MEM_ACCESS_DISABLE   0x00
 
#define WAVEFORM4_BUF_READ   0x08
 
#define WAVEFORM4_START_PATTERN   0x01
 
#define WAVEFORM4_STOP_PATTERN   0x00
 
#define WAVEFORM4_CHANNEL_1   0x00
 Waveform 4 channel selection macros.
 
#define WAVEFORM4_CHANNEL_2   0x01
 
#define WAVEFORM4_CHANNEL_3   0x02
 
#define WAVEFORM4_CHANNEL_4   0x03
 
#define WAVEFORM4_WAVE_SINE   0x00
 Waveform 4 wave output selection macros.
 
#define WAVEFORM4_WAVE_COSINE   0x01
 
#define WAVEFORM4_WAVE_TRIANGLE   0x02
 
#define WAVEFORM4_WAVE_POSITIVE_SAWTOOTH   0x03
 
#define WAVEFORM4_WAVE_NEGATIVE_SAWTOOTH   0x04
 
#define WAVEFORM4_GAIN_MAX   2.0
 Waveform 4 gain calculation macros.
 
#define WAVEFORM4_GAIN_MIN   (-2.0)
 
#define WAVEFORM4_GAIN_RESOLUTION   1024
 
#define WAVEFORM4_MASTER_CLOCK   125000000
 Waveform 4 frequency calculation constants.
 
#define WAVEFORM4_FREQ_RESOLUTION   0x1000000
 
#define WAVEFORM4_SPI_READ_MASK   0x80
 Waveform 4 SPI read/write setting.
 
#define WAVEFORM4_SPI_WRITE_MASK   0x7F
 
#define WAVEFORM4_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define WAVEFORM4_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define WAVEFORM4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  waveform4_return_value_t { WAVEFORM4_OK = 0 , WAVEFORM4_ERROR = -1 }
 Waveform 4 Click return value data. More...
 

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

This file contains API for Waveform 4 Click Driver.

Enumeration Type Documentation

◆ waveform4_return_value_t

Waveform 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
WAVEFORM4_OK 
WAVEFORM4_ERROR