Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_spi_master.h"
68 #define DIGIPOT_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
70 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
71 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
72 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
90 #define DIGIPOT_DATA_EEPROM_6 0x06
91 #define DIGIPOT_DATA_EEPROM_7 0x07
92 #define DIGIPOT_DATA_EEPROM_8 0x08
93 #define DIGIPOT_DATA_EEPROM_9 0x09
94 #define DIGIPOT_DATA_EEPROM_A 0x0A
95 #define DIGIPOT_DATA_EEPROM_B 0x0B
96 #define DIGIPOT_DATA_EEPROM_C 0x0C
97 #define DIGIPOT_DATA_EEPROM_D 0x0D
98 #define DIGIPOT_DATA_EEPROM_E 0x0E
99 #define DIGIPOT_DATA_EEPROM_F 0x0F
100 #define DIGIPOT_DATA_WRITE_CMD 0x20
106 #define DIGIPOT_VOLATILE_WIPER_0 0x00
107 #define DIGIPOT_VOLATILE_WIPER_1 0x01
108 #define DIGIPOT_NON_VOLATILE_WIPER_0 0x02
109 #define DIGIPOT_NON_VOLATILE_WIPER_1 0x03
110 #define DIGIPOT_VOLATILE_TCON_REGISTER 0x04
111 #define DIGIPOT_STATUS_REGISTER 0x05
void digipot_set_wiper_positions(digipot_t *ctx, uint8_t wiper_pos)
Set wiper position.
spi_master_t spi
Definition: digipot.h:127
pin_name_t cs
Definition: digipot.h:143
spi_master_chip_select_polarity_t cs_polarity
Definition: digipot.h:149
DIGI POT Click context object.
Definition: digipot.h:121
void digipot_generic_transfer(digipot_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
digital_out_t cs
Definition: digipot.h:124
void digipot_cfg_setup(digipot_cfg_t *cfg)
DIGI POT configuration object setup function.
uint8_t wiper_pos
Definition: main.c:28
err_t digipot_init(digipot_t *ctx, digipot_cfg_t *cfg)
DIGI POT initialization function.
@ DIGIPOT_ERROR
Definition: digipot.h:160
pin_name_t miso
Definition: digipot.h:140
float digipot_convert_output(uint16_t adc_val, float v_ref)
Convert ADC value to volatage.
pin_name_t mosi
Definition: digipot.h:141
@ DIGIPOT_OK
Definition: digipot.h:159
digipot_return_value_t
DIGI POT Click return value data.
Definition: digipot.h:158
spi_master_mode_t spi_mode
Definition: digipot.h:148
pin_name_t chip_select
Definition: digipot.h:129
pin_name_t sck
Definition: digipot.h:142
DIGI POT Click configuration object.
Definition: digipot.h:138
uint32_t spi_speed
Definition: digipot.h:147