42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_spi_master.h"
68#define DIGIPOT3_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
70 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
71 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
72 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
74 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT );
81#define DIGIPOT3_RETVAL uint8_t
83#define DIGIPOT3_OK 0x00
84#define DIGIPOT3_INIT_ERROR 0xFF
91#define DIGIPOT3_DO_NOTHING_COMM 0x00
92#define DIGIPOT3_RESTORE_EEMEM_TO_RDAC_COMM 0x01
93#define DIGIPOT3_STORE_RDAC_TO_EEMEM_COMM 0x02
94#define DIGIPOT3_DECREMENT_RDAC_6DB_COMM 0x04
95#define DIGIPOT3_DECREMENT_RDAC_ONESTEP_COMM 0x06
96#define DIGIPOT3_RESTORE_RDAC_WITH_EEMEM_COMM 0x08
97#define DIGIPOT3_INCREMENT_RDAC_6DB_COMM 0x0C
98#define DIGIPOT3_INCREMENT_RDAC_ONESTEP_COMM 0x0E
105#define DIGIPOT3_RDAC_EEMEM_LOC 0x00
106#define DIGIPOT3_O1_O2_EEMEM_LOC 0x01
107#define DIGIPOT3_USER1_EEMEM_LOC 0x02
108#define DIGIPOT3_USER2_EEMEM_LOC 0x03
109#define DIGIPOT3_USER3_EEMEM_LOC 0x04
110#define DIGIPOT3_USER4_EEMEM_LOC 0x05
111#define DIGIPOT3_USER5_EEMEM_LOC 0x06
112#define DIGIPOT3_USER6_EEMEM_LOC 0x07
113#define DIGIPOT3_USER7_EEMEM_LOC 0x08
114#define DIGIPOT3_USER8_EEMEM_LOC 0x09
115#define DIGIPOT3_USER9_EEMEM_LOC 0x0A
116#define DIGIPOT3_USER10_EEMEM_LOC 0x0B
117#define DIGIPOT3_USER11_EEMEM_LOC 0x0C
118#define DIGIPOT3_USER12_EEMEM_LOC 0x0D
119#define DIGIPOT3_USER13_EEMEM_LOC 0x0E
120#define DIGIPOT3_USER14_EEMEM_LOC 0x0F
127#define DIGIPOT3_ZERO_SCALE 0x0000
128#define DIGIPOT3_QUARTER_SCALE 0x0100
129#define DIGIPOT3_HALF_SCALE 0x0200
130#define DIGIPOT3_THREE_QUARTERS_SCALE 0x0300
131#define DIGIPOT3_FULL_SCALE 0x03FF
228 uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len );
#define DIGIPOT3_RETVAL
Definition digipot3.h:81
uint8_t digipot3_check_data_ready(digipot3_t *ctx)
Data Ready Check function.
uint8_t digipot3_send_command(digipot3_t *ctx, uint8_t command_byte)
Command Send function.
uint8_t digipot3_store_eemem(digipot3_t *ctx, uint8_t location_address, uint16_t transfer_data)
EEMEM Store function.
uint8_t digipot3_read_eemem(digipot3_t *ctx, uint8_t location_address, uint16_t *data_out)
EEMEM Read function.
void digipot3_read_dac(digipot3_t *ctx, uint16_t *data_out)
DAC Read function.
void digipot2_generic_transfer(digipot3_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void digipot3_cfg_setup(digipot3_cfg_t *cfg)
Config Object Initialization function.
DIGIPOT3_RETVAL digipot3_init(digipot3_t *ctx, digipot3_cfg_t *cfg)
Initialization function.
uint8_t digipot3_write_dac(digipot3_t *ctx, uint16_t value_dac)
DAC Write function.
Click configuration structure definition.
Definition digipot3.h:164
spi_master_chip_select_polarity_t cs_polarity
Definition digipot3.h:181
pin_name_t sck
Definition digipot3.h:169
spi_master_mode_t spi_mode
Definition digipot3.h:180
pin_name_t mosi
Definition digipot3.h:168
uint32_t spi_speed
Definition digipot3.h:179
pin_name_t rdy
Definition digipot3.h:175
pin_name_t miso
Definition digipot3.h:167
pin_name_t an
Definition digipot3.h:174
pin_name_t cs
Definition digipot3.h:170
Click ctx object definition.
Definition digipot3.h:145
digital_out_t cs
Definition digipot3.h:146
spi_master_t spi
Definition digipot3.h:155
digital_in_t an
Definition digipot3.h:150
pin_name_t chip_select
Definition digipot3.h:156
digital_in_t rdy
Definition digipot3.h:151