dac12 2.0.0.0
dac12.h File Reference

This file contains API for DAC 12 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  dac12_t
 DAC 12 Click context object. More...
 
struct  dac12_cfg_t
 DAC 12 Click configuration object. More...
 

Macros

#define DAC12_REG_NOP   0x00
 DAC 12 Register Map.
 
#define DAC12_REG_DEVICE_ID   0x01
 
#define DAC12_REG_SYNC   0x02
 
#define DAC12_REG_CONFIG   0x03
 
#define DAC12_REG_GAIN   0x04
 
#define DAC12_REG_TRIGGER   0x05
 
#define DAC12_REG_BROADCAST   0x06
 
#define DAC12_REG_STATUS   0x07
 
#define DAC12_REG_DAC0   0x08
 
#define DAC12_REG_DAC1   0x09
 
#define DAC12_REG_DAC2   0x0A
 
#define DAC12_REG_DAC3   0x0B
 
#define DAC12_REG_DAC4   0x0C
 
#define DAC12_REG_DAC5   0x0D
 
#define DAC12_REG_DAC6   0x0E
 
#define DAC12_REG_DAC7   0x0F
 
#define DAC12_SELECT_CHANNEL_NONE   0x00
 DAC 12 select channel flags.
 
#define DAC12_SELECT_CHANNEL_0   0x01
 
#define DAC12_SELECT_CHANNEL_1   0x02
 
#define DAC12_SELECT_CHANNEL_2   0x04
 
#define DAC12_SELECT_CHANNEL_3   0x08
 
#define DAC12_SELECT_CHANNEL_4   0x10
 
#define DAC12_SELECT_CHANNEL_5   0x20
 
#define DAC12_SELECT_CHANNEL_6   0x40
 
#define DAC12_SELECT_CHANNEL_7   0x80
 
#define DAC12_SELECT_CHANNEL_ALL   0xFF
 
#define DAC12_GAIN_REFDIV_EN   0x0100
 DAC 12 gain register settings.
 
#define DAC12_MIN_DAC_VALUE   0x0000
 DAC 12 range values.
 
#define DAC12_MAX_DAC_VALUE   0x0FFF
 
#define DAC12_INTERNAL_VREF   2.5
 DAC 12 vref values.
 
#define DAC12_SOFT_RESET   0x000A
 DAC 12 soft reset value.
 
#define DAC12_DEVICE_ID   0x2894
 DAC 12 device ID value.
 
#define DAC12_DEVICE_ID_MASK   0xFFFC
 
#define DAC12_SPI_READ   0x80
 DAC 12 SPI read bit.
 
#define DAC12_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define DAC12_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DAC12_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  dac12_return_value_t { DAC12_OK = 0 , DAC12_ERROR = -1 }
 DAC 12 Click return value data. More...
 

Functions

void dac12_cfg_setup (dac12_cfg_t *cfg)
 DAC 12 configuration object setup function.
 
err_t dac12_init (dac12_t *ctx, dac12_cfg_t *cfg)
 DAC 12 initialization function.
 
err_t dac12_default_cfg (dac12_t *ctx)
 DAC 12 default configuration function.
 
err_t dac12_write_register (dac12_t *ctx, uint8_t reg, uint16_t data_in)
 DAC 12 write register function.
 
err_t dac12_read_register (dac12_t *ctx, uint8_t reg, uint16_t *data_out)
 DAC 12 read register function.
 
err_t dac12_check_communication (dac12_t *ctx)
 DAC 12 check communication function.
 
err_t dac12_soft_reset (dac12_t *ctx)
 DAC 12 soft reset function.
 
err_t dac12_set_gain (dac12_t *ctx, uint8_t channel)
 DAC 12 set gain function.
 
err_t dac12_set_channel_value (dac12_t *ctx, uint8_t channel, uint16_t dac_value)
 DAC 12 set channel value function.
 
err_t dac12_set_channel_voltage (dac12_t *ctx, uint8_t channel, float voltage)
 DAC 12 set channel voltage function.
 

Detailed Description

This file contains API for DAC 12 Click Driver.

Enumeration Type Documentation

◆ dac12_return_value_t

DAC 12 Click return value data.

Predefined enum values for driver return values.

Enumerator
DAC12_OK 
DAC12_ERROR