38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40#include "drv_spi_master.h"
53#define DIGIPOT6_MAP_MIKROBUS( cfg, mikrobus ) \
54 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
55 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
56 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
57 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
64#define DIGIPOT6_RETVAL uint8_t
66#define DIGIPOT6_OK 0x00
67#define DIGIPOT6_INIT_ERROR 0xFF
74#define DIGIPOT6_CMD_WRITE 0x00
75#define DIGIPOT6_CMD_INCREMENT 0x01
76#define DIGIPOT6_CMD_DECREMENT 0x02
77#define DIGIPOT6_CMD_READ 0x03
84#define DIGIPOT6_VOLATILE_WIPER_0 0x00
85#define DIGIPOT6_TCON_REG 0x04
92#define DIGIPOT6_TCON_R0B 0xF1
93#define DIGIPOT6_TCON_R0W 0xF2
94#define DIGIPOT6_TCON_R0A 0xF4
95#define DIGIPOT6_TCON_R0HW 0xF8
97#define DIGIPOT6_TCON_MASK_R0B 0xFE
98#define DIGIPOT6_TCON_MASK_R0W 0xFD
99#define DIGIPOT6_TCON_MASK_R0A 0xFB
100#define DIGIPOT6_TCON_MASK_R0HW 0xF7
107#define DIGIPOT6_CONNECT 0x01
108#define DIGIPOT6_DISCONNECT 0x00
#define DIGIPOT6_RETVAL
Definition: digipot6.h:64
void digipot6_set_resistor(digipot6_t *ctx, uint8_t state, uint8_t mask, uint8_t tcon)
Set resistor function.
void digipot6_cfg_setup(digipot6_cfg_t *cfg)
Config Object Initialization function.
uint8_t digipot6_read_data(digipot6_t *ctx, uint8_t reg)
Read data function.
void digipot6_default_cfg(digipot6_t *ctx)
Click Default Configuration function.
void digipot6_write_wiper_cmd(digipot6_t *ctx, uint8_t cmd)
Write wiper command function.
DIGIPOT6_RETVAL digipot6_init(digipot6_t *ctx, digipot6_cfg_t *cfg)
Initialization function.
void digipot6_write_data(digipot6_t *ctx, uint8_t reg, uint8_t w_data)
Write data function.
Click configuration structure definition.
Definition: digipot6.h:138
spi_master_chip_select_polarity_t cs_polarity
Definition: digipot6.h:150
pin_name_t sck
Definition: digipot6.h:143
spi_master_mode_t spi_mode
Definition: digipot6.h:149
pin_name_t mosi
Definition: digipot6.h:142
uint32_t spi_speed
Definition: digipot6.h:148
pin_name_t miso
Definition: digipot6.h:141
pin_name_t cs
Definition: digipot6.h:144
Click ctx object definition.
Definition: digipot6.h:122
digital_out_t cs
Definition: digipot6.h:125
spi_master_t spi
Definition: digipot6.h:129
pin_name_t chip_select
Definition: digipot6.h:130