39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
74#define DAC12_REG_NOP 0x00
75#define DAC12_REG_DEVICE_ID 0x01
76#define DAC12_REG_SYNC 0x02
77#define DAC12_REG_CONFIG 0x03
78#define DAC12_REG_GAIN 0x04
79#define DAC12_REG_TRIGGER 0x05
80#define DAC12_REG_BROADCAST 0x06
81#define DAC12_REG_STATUS 0x07
82#define DAC12_REG_DAC0 0x08
83#define DAC12_REG_DAC1 0x09
84#define DAC12_REG_DAC2 0x0A
85#define DAC12_REG_DAC3 0x0B
86#define DAC12_REG_DAC4 0x0C
87#define DAC12_REG_DAC5 0x0D
88#define DAC12_REG_DAC6 0x0E
89#define DAC12_REG_DAC7 0x0F
107#define DAC12_SELECT_CHANNEL_NONE 0x00
108#define DAC12_SELECT_CHANNEL_0 0x01
109#define DAC12_SELECT_CHANNEL_1 0x02
110#define DAC12_SELECT_CHANNEL_2 0x04
111#define DAC12_SELECT_CHANNEL_3 0x08
112#define DAC12_SELECT_CHANNEL_4 0x10
113#define DAC12_SELECT_CHANNEL_5 0x20
114#define DAC12_SELECT_CHANNEL_6 0x40
115#define DAC12_SELECT_CHANNEL_7 0x80
116#define DAC12_SELECT_CHANNEL_ALL 0xFF
122#define DAC12_GAIN_REFDIV_EN 0x0100
128#define DAC12_MIN_DAC_VALUE 0x0000
129#define DAC12_MAX_DAC_VALUE 0x0FFF
135#define DAC12_INTERNAL_VREF 2.5
141#define DAC12_SOFT_RESET 0x000A
147#define DAC12_DEVICE_ID 0x2894
148#define DAC12_DEVICE_ID_MASK 0xFFFC
154#define DAC12_SPI_READ 0x80
164#define DAC12_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
165#define DAC12_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
183#define DAC12_MAP_MIKROBUS( cfg, mikrobus ) \
184 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
185 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
186 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
187 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS );
dac12_return_value_t
DAC 12 Click return value data.
Definition dac12.h:231
@ DAC12_ERROR
Definition dac12.h:233
@ DAC12_OK
Definition dac12.h:232
err_t dac12_set_channel_voltage(dac12_t *ctx, uint8_t channel, float voltage)
DAC 12 set channel voltage function.
void dac12_cfg_setup(dac12_cfg_t *cfg)
DAC 12 configuration object setup function.
err_t dac12_check_communication(dac12_t *ctx)
DAC 12 check communication function.
err_t dac12_read_register(dac12_t *ctx, uint8_t reg, uint16_t *data_out)
DAC 12 read register function.
err_t dac12_set_gain(dac12_t *ctx, uint8_t channel)
DAC 12 set gain function.
err_t dac12_default_cfg(dac12_t *ctx)
DAC 12 default configuration function.
err_t dac12_init(dac12_t *ctx, dac12_cfg_t *cfg)
DAC 12 initialization 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_soft_reset(dac12_t *ctx)
DAC 12 soft reset function.
err_t dac12_write_register(dac12_t *ctx, uint8_t reg, uint16_t data_in)
DAC 12 write register function.
This file contains SPI specific macros, functions, etc.
DAC 12 Click configuration object.
Definition dac12.h:212
spi_master_chip_select_polarity_t cs_polarity
Definition dac12.h:222
pin_name_t sck
Definition dac12.h:216
spi_master_mode_t spi_mode
Definition dac12.h:221
pin_name_t mosi
Definition dac12.h:215
uint32_t spi_speed
Definition dac12.h:220
pin_name_t miso
Definition dac12.h:214
pin_name_t cs
Definition dac12.h:217
DAC 12 Click context object.
Definition dac12.h:197
spi_master_t spi
Definition dac12.h:199
pin_name_t channel_gain
Definition dac12.h:203
pin_name_t chip_select
Definition dac12.h:201