Go to the documentation of this file.
38 #include "mikrosdk_version.h"
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_spi_master.h"
63 #define DIGIPOT6_MAP_MIKROBUS( cfg, mikrobus ) \
64 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
65 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
66 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
67 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
74 #define DIGIPOT6_RETVAL uint8_t
76 #define DIGIPOT6_OK 0x00
77 #define DIGIPOT6_INIT_ERROR 0xFF
84 #define DIGIPOT6_CMD_WRITE 0x00
85 #define DIGIPOT6_CMD_INCREMENT 0x01
86 #define DIGIPOT6_CMD_DECREMENT 0x02
87 #define DIGIPOT6_CMD_READ 0x03
94 #define DIGIPOT6_VOLATILE_WIPER_0 0x00
95 #define DIGIPOT6_TCON_REG 0x04
102 #define DIGIPOT6_TCON_R0B 0xF1
103 #define DIGIPOT6_TCON_R0W 0xF2
104 #define DIGIPOT6_TCON_R0A 0xF4
105 #define DIGIPOT6_TCON_R0HW 0xF8
107 #define DIGIPOT6_TCON_MASK_R0B 0xFE
108 #define DIGIPOT6_TCON_MASK_R0W 0xFD
109 #define DIGIPOT6_TCON_MASK_R0A 0xFB
110 #define DIGIPOT6_TCON_MASK_R0HW 0xF7
117 #define DIGIPOT6_CONNECT 0x01
118 #define DIGIPOT6_DISCONNECT 0x00
250 #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:153
#define DIGIPOT6_RETVAL
Definition: digipot6.h:74
Click ctx object definition.
Definition: digipot6.h:132
pin_name_t miso
Definition: digipot6.h:151
pin_name_t chip_select
Definition: digipot6.h:140
void digipot6_write_wiper_cmd(digipot6_t *ctx, uint8_t cmd)
Write wiper command function.
pin_name_t mosi
Definition: digipot6.h:152
Click configuration structure definition.
Definition: digipot6.h:148
spi_master_mode_t spi_mode
Definition: digipot6.h:159
uint8_t digipot6_read_data(digipot6_t *ctx, uint8_t reg)
Read data function.
uint32_t spi_speed
Definition: digipot6.h:158
digital_out_t cs
Definition: digipot6.h:135
void digipot6_cfg_setup(digipot6_cfg_t *cfg)
Config Object Initialization function.
spi_master_t spi
Definition: digipot6.h:139
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:160
pin_name_t cs
Definition: digipot6.h:154
DIGIPOT6_RETVAL digipot6_init(digipot6_t *ctx, digipot6_cfg_t *cfg)
Initialization function.