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 DAC11_CMD_CHANNEL_A 0x00
75#define DAC11_CMD_CHANNEL_B 0x01
76#define DAC11_CMD_CHANNEL_C 0x02
77#define DAC11_CMD_CHANNEL_D 0x03
78#define DAC11_CMD_CHANNEL_E 0x04
79#define DAC11_CMD_CHANNEL_F 0x05
80#define DAC11_CMD_CHANNEL_G 0x06
81#define DAC11_CMD_CHANNEL_H 0x07
82#define DAC11_CMD_WRM 0x08
83#define DAC11_CMD_WTM 0x09
84#define DAC11_CMD_UPDATE_SELECT 0x0A
85#define DAC11_CMD_CHANNEL_A_WRITE 0x0B
86#define DAC11_CMD_BROADCAST 0x0C
87#define DAC11_CMD_PD_HIGH_Z 0x0D
88#define DAC11_CMD_PD_100KOHM 0x0E
89#define DAC11_CMD_PD_2p5KOHM 0x0F
107#define DAC11_SELECT_CHANNEL_A 0x01
108#define DAC11_SELECT_CHANNEL_B 0x02
109#define DAC11_SELECT_CHANNEL_C 0x04
110#define DAC11_SELECT_CHANNEL_D 0x08
111#define DAC11_SELECT_CHANNEL_E 0x10
112#define DAC11_SELECT_CHANNEL_F 0x20
113#define DAC11_SELECT_CHANNEL_G 0x40
114#define DAC11_SELECT_CHANNEL_H 0x80
115#define DAC11_SELECT_ALL_CHANNELS 0xFF
121#define DAC11_MIN_DAC_VALUE 0x0000
122#define DAC11_MAX_DAC_VALUE 0x0FFF
128#define DAC11_VREF_3V3 3.3
129#define DAC11_VREF_5V 5
139#define DAC11_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
140#define DAC11_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
158#define DAC11_MAP_MIKROBUS( cfg, mikrobus ) \
159 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
160 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
161 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
162 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS );
dac11_return_value_t
DAC 11 Click return value data.
Definition dac11.h:204
@ DAC11_ERROR
Definition dac11.h:206
@ DAC11_OK
Definition dac11.h:205
err_t dac11_set_all_ch_voltage(dac11_t *ctx, float vref, float voltage)
DAC 11 set all channels voltage function.
void dac11_cfg_setup(dac11_cfg_t *cfg)
DAC 11 configuration object setup function.
err_t dac11_default_cfg(dac11_t *ctx)
DAC 11 default configuration function.
err_t dac11_generic_write(dac11_t *ctx, uint16_t *data_in, uint8_t len)
DAC 11 generic write function.
err_t dac11_set_all_ch_value(dac11_t *ctx, uint16_t dac_value)
DAC 11 set all channels value function.
err_t dac11_init(dac11_t *ctx, dac11_cfg_t *cfg)
DAC 11 initialization function.
err_t dac11_set_specific_ch_value(dac11_t *ctx, uint8_t channel, uint16_t dac_value)
DAC 11 set specific channels value function.
err_t dac11_set_specific_ch_voltage(dac11_t *ctx, uint8_t channel, float vref, float voltage)
DAC 11 set specific channels voltage function.
err_t dac11_write_control_reg(dac11_t *ctx, uint8_t cmd, uint16_t data_in)
DAC 11 write control register function.
This file contains SPI specific macros, functions, etc.
DAC 11 Click configuration object.
Definition dac11.h:185
spi_master_chip_select_polarity_t cs_polarity
Definition dac11.h:195
pin_name_t sck
Definition dac11.h:189
spi_master_mode_t spi_mode
Definition dac11.h:194
pin_name_t mosi
Definition dac11.h:188
uint32_t spi_speed
Definition dac11.h:193
pin_name_t miso
Definition dac11.h:187
pin_name_t cs
Definition dac11.h:190
DAC 11 Click context object.
Definition dac11.h:172
spi_master_t spi
Definition dac11.h:174
pin_name_t chip_select
Definition dac11.h:176