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"
67#define DIGIPOT4_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
69 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
70 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
71 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
79#define DIGIPOT4_RETVAL uint8_t
81#define DIGIPOT4_OK 0x00
82#define DIGIPOT4_INIT_ERROR 0xFF
89#define DIGIPOT4_WIPER_REG_1 0x01
90#define DIGIPOT4_WIPER_REG_2 0x02
97#define DIGIPOT4_NV_REG_1 0x11
98#define DIGIPOT4_NV_REG_2 0x12
105#define DIGIPOT4_COPY_WIPER_TO_NV_1 0x21
106#define DIGIPOT4_COPY_WIPER_TO_NV_2 0x22
107#define DIGIPOT4_COPY_WIPER_TO_NV_1_2 0x23
114#define DIGIPOT4_COPY_NV_TO_WIPER_1 0x31
115#define DIGIPOT4_COPY_NV_TO_WIPER_2 0x32
116#define DIGIPOT4_COPY_NV_TO_WIPER_1_2 0x33
205 uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len );
#define DIGIPOT4_RETVAL
Definition digipot4.h:79
void digipot4_cfg_setup(digipot4_cfg_t *cfg)
Config Object Initialization function.
void digipot4_generic_transfer(digipot4_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void digipot4_write_reg(digipot4_t *ctx, uint8_t reg, uint16_t value)
Writes data in register.
DIGIPOT4_RETVAL digipot4_init(digipot4_t *ctx, digipot4_cfg_t *cfg)
Initialization function.
void digipot4_copy_reg(digipot4_t *ctx, uint8_t reg)
Copy data.
Click configuration structure definition.
Definition digipot4.h:146
spi_master_chip_select_polarity_t cs_polarity
Definition digipot4.h:158
pin_name_t sck
Definition digipot4.h:151
spi_master_mode_t spi_mode
Definition digipot4.h:157
pin_name_t mosi
Definition digipot4.h:150
uint32_t spi_speed
Definition digipot4.h:156
pin_name_t miso
Definition digipot4.h:149
pin_name_t cs
Definition digipot4.h:152
Click ctx object definition.
Definition digipot4.h:130
digital_out_t cs
Definition digipot4.h:133
spi_master_t spi
Definition digipot4.h:137
pin_name_t chip_select
Definition digipot4.h:138