42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_spi_master.h"
64#define DIGIPOT5_RETVAL uint8_t
66#define DIGIPOT5_OK 0x00
67#define DIGIPOT5_INIT_ERROR 0xFF
74#define DIGIPOT5_RES_ZEROSCALE 0x00
75#define DIGIPOT5_RES_1KOHM 0x1A
76#define DIGIPOT5_RES_2KOHM 0x34
77#define DIGIPOT5_RES_3KOHM 0x4E
78#define DIGIPOT5_RES_5KOHM_HALFSCALE 0x80
79#define DIGIPOT5_RES_7KOHM 0xB6
80#define DIGIPOT5_RES_8KOHM 0xD0
81#define DIGIPOT5_RES_10KOHM_FULLSCALE 0x100
88#define DIGIPOT5_MAP_MIKROBUS( cfg, mikrobus ) \
89 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
90 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
91 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
92 cfg.sdo = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
93 cfg.sdi = MIKROBUS( mikrobus, MIKROBUS_MOSI )
267 uint16_t *data_out );
void digipot5_cfg_setup(digipot5_cfg_t *cfg)
Configuration Object Setup function.
digipot5_err_t digipot5_generic_read(digipot5_t *ctx, digipot5_reg_t reg_addr, uint16_t *data_out)
Generic Read function.
digipot5_reg_t digipot5_decrement_wiper(digipot5_t *ctx, digipot5_reg_t reg_addr)
Decrement Wiper function.
digipot5_reg_t digipot5_increment_wiper(digipot5_t *ctx, digipot5_reg_t reg_addr)
Increment Wiper function.
void digipot5_default_cfg(digipot5_t *ctx)
Click Default Configuration function.
digipot5_err_t digipot5_generic_write(digipot5_t *ctx, digipot5_reg_t reg_addr, uint16_t data_in)
Generic Write function.
void digipot5_reset(digipot5_t *ctx)
Reset function.
digipot5_err_t digipot5_init(digipot5_t *ctx, digipot5_cfg_t *cfg)
Click Initialization function.
digipot5_reg_t
Click register address definition.
Definition digipot5.h:119
digipot5_err_t
Click error code definition.
Definition digipot5.h:107
@ DIGIPOT5_REG_TCON0_VOL
Definition digipot5.h:124
@ DIGIPOT5_REG_WIPER3_NONVOL
Definition digipot5.h:129
@ DIGIPOT5_REG_EEPROM4_NONVOL
Definition digipot5.h:135
@ DIGIPOT5_REG_EEPROM2_NONVOL
Definition digipot5.h:133
@ DIGIPOT5_REG_EEPROM3_NONVOL
Definition digipot5.h:134
@ DIGIPOT5_REG_WIPER0_NONVOL
Definition digipot5.h:122
@ DIGIPOT5_REG_WIPER1_VOL
Definition digipot5.h:121
@ DIGIPOT5_REG_TCON1_VOL
Definition digipot5.h:130
@ DIGIPOT5_REG_EEPROM1_NONVOL
Definition digipot5.h:132
@ DIGIPOT5_REG_WIPER2_NONVOL
Definition digipot5.h:128
@ DIGIPOT5_REG_STATUS_VOL
Definition digipot5.h:125
@ DIGIPOT5_REG_WIPER2_VOL
Definition digipot5.h:126
@ DIGIPOT5_REG_WIPER1_NONVOL
Definition digipot5.h:123
@ DIGIPOT5_REG_EEPROM0_NONVOL
Definition digipot5.h:131
@ DIGIPOT5_REG_WIPER0_VOL
Definition digipot5.h:120
@ DIGIPOT5_REG_WIPER3_VOL
Definition digipot5.h:127
@ DIGIPOT5_ERROR_CMD
Definition digipot5.h:109
@ DIGIPOT5_ERROR_REG_ADDR
Definition digipot5.h:111
@ DIGIPOT5_STATUS_OK
Definition digipot5.h:108
@ DIGIPOT5_ERROR_INIT_DRV
Definition digipot5.h:110
Click configuration structure definition.
Definition digipot5.h:159
pin_name_t sdi
Definition digipot5.h:164
spi_master_chip_select_polarity_t cs_polarity
Definition digipot5.h:172
pin_name_t sck
Definition digipot5.h:162
spi_master_mode_t spi_mode
Definition digipot5.h:171
uint32_t spi_speed
Definition digipot5.h:170
pin_name_t sdo
Definition digipot5.h:163
pin_name_t rst
Definition digipot5.h:167
pin_name_t cs
Definition digipot5.h:161
Click context object definition.
Definition digipot5.h:143
digital_out_t cs
Definition digipot5.h:144
spi_master_t spi
Definition digipot5.h:150
digital_out_t rst
Definition digipot5.h:147
pin_name_t chip_select
Definition digipot5.h:151