Go to the documentation of this file.
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 DIGIPOT6_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 )
78 #define DIGIPOT6_RETVAL uint8_t
80 #define DIGIPOT6_OK 0x00
81 #define DIGIPOT6_INIT_ERROR 0xFF
88 #define DIGIPOT6_CMD_WRITE 0x00
89 #define DIGIPOT6_CMD_INCREMENT 0x01
90 #define DIGIPOT6_CMD_DECREMENT 0x02
91 #define DIGIPOT6_CMD_READ 0x03
98 #define DIGIPOT6_VOLATILE_WIPER_0 0x00
99 #define DIGIPOT6_TCON_REG 0x04
106 #define DIGIPOT6_TCON_R0B 0xF1
107 #define DIGIPOT6_TCON_R0W 0xF2
108 #define DIGIPOT6_TCON_R0A 0xF4
109 #define DIGIPOT6_TCON_R0HW 0xF8
111 #define DIGIPOT6_TCON_MASK_R0B 0xFE
112 #define DIGIPOT6_TCON_MASK_R0W 0xFD
113 #define DIGIPOT6_TCON_MASK_R0A 0xFB
114 #define DIGIPOT6_TCON_MASK_R0HW 0xF7
121 #define DIGIPOT6_CONNECT 0x01
122 #define DIGIPOT6_DISCONNECT 0x00
254 #endif // _DIGIPOT6_H_
void digipot6_default_cfg(digipot6_t *ctx)
Click Default Configuration function.
void digipot6_write_data(digipot6_t *ctx, uint8_t reg, uint8_t w_data)
Write data function.
pin_name_t sck
Definition: digipot6.h:157
#define DIGIPOT6_RETVAL
Definition: digipot6.h:78
Click ctx object definition.
Definition: digipot6.h:136
pin_name_t miso
Definition: digipot6.h:155
pin_name_t chip_select
Definition: digipot6.h:144
void digipot6_write_wiper_cmd(digipot6_t *ctx, uint8_t cmd)
Write wiper command function.
pin_name_t mosi
Definition: digipot6.h:156
Click configuration structure definition.
Definition: digipot6.h:152
spi_master_mode_t spi_mode
Definition: digipot6.h:163
uint8_t digipot6_read_data(digipot6_t *ctx, uint8_t reg)
Read data function.
uint32_t spi_speed
Definition: digipot6.h:162
digital_out_t cs
Definition: digipot6.h:139
void digipot6_cfg_setup(digipot6_cfg_t *cfg)
Config Object Initialization function.
spi_master_t spi
Definition: digipot6.h:143
void digipot6_set_resistor(digipot6_t *ctx, uint8_t state, uint8_t mask, uint8_t tcon)
Set resistor function.
spi_master_chip_select_polarity_t cs_polarity
Definition: digipot6.h:164
pin_name_t cs
Definition: digipot6.h:158
DIGIPOT6_RETVAL digipot6_init(digipot6_t *ctx, digipot6_cfg_t *cfg)
Initialization function.