39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
73#define DIGIPOT9_CMD_NOP 0
74#define DIGIPOT9_CMD_RESTORE_EEMEM 1
75#define DIGIPOT9_CMD_STORE_RDAC 2
76#define DIGIPOT9_CMD_STORE_USER_DATA 3
77#define DIGIPOT9_CMD_DECREMENT_6DB 4
78#define DIGIPOT9_CMD_DECREMENT_ALL_6DB 5
79#define DIGIPOT9_CMD_DECREMENT_ONE_STEP 6
80#define DIGIPOT9_CMD_DECREMENT_ALL_ONE_STEP 7
81#define DIGIPOT9_CMD_RESET_EEMEM 8
82#define DIGIPOT9_CMD_READ_EEMEM 9
83#define DIGIPOT9_CMD_READ_RDAC 10
84#define DIGIPOT9_CMD_WRITE_DATA 11
85#define DIGIPOT9_CMD_INCREMENT_6DB 12
86#define DIGIPOT9_CMD_INCREMENT_ALL_6DB 13
87#define DIGIPOT9_CMD_INCREMENT_ONE_STEP 14
88#define DIGIPOT9_CMD_INCREMENT_ALL_ONE_STEP 15
94#define DIGIPOT9_ADDRESS_RDAC1 0
95#define DIGIPOT9_ADDRESS_RDAC2 1
96#define DIGIPOT9_ADDRESS_USER_DATA_0 2
97#define DIGIPOT9_ADDRESS_USER_DATA_1 3
98#define DIGIPOT9_ADDRESS_USER_DATA_2 4
99#define DIGIPOT9_ADDRESS_USER_DATA_3 5
100#define DIGIPOT9_ADDRESS_USER_DATA_4 6
101#define DIGIPOT9_ADDRESS_USER_DATA_5 7
102#define DIGIPOT9_ADDRESS_USER_DATA_6 8
103#define DIGIPOT9_ADDRESS_USER_DATA_7 9
104#define DIGIPOT9_ADDRESS_USER_DATA_8 10
105#define DIGIPOT9_ADDRESS_USER_DATA_9 11
106#define DIGIPOT9_ADDRESS_USER_DATA_10 12
107#define DIGIPOT9_ADDRESS_USER_DATA_11 13
108#define DIGIPOT9_ADDRESS_USER_DATA_12 14
109#define DIGIPOT9_ADDRESS_FACTORY_USAGE 15
127#define DIGIPOT9_WIPER_FULL_SCALE 1023
128#define DIGIPOT9_WIPER_MID_SCALE 512
129#define DIGIPOT9_WIPER_ZERO_SCALE 0
147#define DIGIPOT9_MAP_MIKROBUS( cfg, mikrobus ) \
148 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
149 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
150 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
151 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
152 cfg.pr = MIKROBUS( mikrobus, MIKROBUS_RST ); \
153 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
154 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT )
digipot9_return_value_t
DIGI POT 9 Click return value data.
Definition digipot9.h:208
@ DIGIPOT9_ERROR
Definition digipot9.h:210
@ DIGIPOT9_OK
Definition digipot9.h:209
err_t digipot9_read_user_data(digipot9_t *ctx, uint8_t address, uint16_t *data_out)
DIGI POT 9 read user data function.
err_t digipot9_set_wiper_1(digipot9_t *ctx, uint16_t data_in)
DIGI POT 9 Set wiper 1 function.
err_t digipot9_write_user_data(digipot9_t *ctx, uint8_t address, uint16_t data_in)
DIGI POT 9 write user data function.
void digipot9_cfg_setup(digipot9_cfg_t *cfg)
DIGI POT 9 configuration object setup function.
void digipot9_set_wp_pin(digipot9_t *ctx, uint8_t state)
DIGI POT 9 Set WP pin function.
uint8_t digipot9_get_rdy_pin(digipot9_t *ctx)
DIGI POT 9 get RDY pin function.
void digipot9_set_pr_pin(digipot9_t *ctx, uint8_t state)
DIGI POT 9 Set PR pin function.
void digipot9_default_cfg(digipot9_t *ctx)
DIGI POT 9 default configuration function.
err_t digipot9_generic_read(digipot9_t *ctx, uint8_t command, uint8_t address, uint16_t *data_out)
DIGI POT 9 data reading function.
err_t digipot9_init(digipot9_t *ctx, digipot9_cfg_t *cfg)
DIGI POT 9 initialization function.
err_t digipot9_set_wiper_2(digipot9_t *ctx, uint16_t data_in)
DIGI POT 9 Set wiper 2 function.
err_t digipot9_generic_write(digipot9_t *ctx, uint8_t command, uint8_t address, uint16_t data_in)
DIGI POT 9 data writing function.
DIGI POT 9 Click configuration object.
Definition digipot9.h:184
spi_master_chip_select_polarity_t cs_polarity
Definition digipot9.h:199
pin_name_t pr
Definition digipot9.h:192
pin_name_t sck
Definition digipot9.h:188
spi_master_mode_t spi_mode
Definition digipot9.h:198
pin_name_t mosi
Definition digipot9.h:187
uint32_t spi_speed
Definition digipot9.h:197
pin_name_t wp
Definition digipot9.h:193
pin_name_t rdy
Definition digipot9.h:194
pin_name_t miso
Definition digipot9.h:186
pin_name_t cs
Definition digipot9.h:189
DIGI POT 9 Click context object.
Definition digipot9.h:164
spi_master_t spi
Definition digipot9.h:173
digital_out_t pr
Definition digipot9.h:166
pin_name_t chip_select
Definition digipot9.h:175
digital_in_t rdy
Definition digipot9.h:170
digital_out_t wp
Definition digipot9.h:167