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"
64 #define DIGIPOT3_MAP_MIKROBUS( cfg, mikrobus ) \
65 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
66 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
67 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
68 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
69 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
70 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT );
77 #define DIGIPOT3_RETVAL uint8_t
79 #define DIGIPOT3_OK 0x00
80 #define DIGIPOT3_INIT_ERROR 0xFF
87 #define DIGIPOT3_DO_NOTHING_COMM 0x00
88 #define DIGIPOT3_RESTORE_EEMEM_TO_RDAC_COMM 0x01
89 #define DIGIPOT3_STORE_RDAC_TO_EEMEM_COMM 0x02
90 #define DIGIPOT3_DECREMENT_RDAC_6DB_COMM 0x04
91 #define DIGIPOT3_DECREMENT_RDAC_ONESTEP_COMM 0x06
92 #define DIGIPOT3_RESTORE_RDAC_WITH_EEMEM_COMM 0x08
93 #define DIGIPOT3_INCREMENT_RDAC_6DB_COMM 0x0C
94 #define DIGIPOT3_INCREMENT_RDAC_ONESTEP_COMM 0x0E
101 #define DIGIPOT3_RDAC_EEMEM_LOC 0x00
102 #define DIGIPOT3_O1_O2_EEMEM_LOC 0x01
103 #define DIGIPOT3_USER1_EEMEM_LOC 0x02
104 #define DIGIPOT3_USER2_EEMEM_LOC 0x03
105 #define DIGIPOT3_USER3_EEMEM_LOC 0x04
106 #define DIGIPOT3_USER4_EEMEM_LOC 0x05
107 #define DIGIPOT3_USER5_EEMEM_LOC 0x06
108 #define DIGIPOT3_USER6_EEMEM_LOC 0x07
109 #define DIGIPOT3_USER7_EEMEM_LOC 0x08
110 #define DIGIPOT3_USER8_EEMEM_LOC 0x09
111 #define DIGIPOT3_USER9_EEMEM_LOC 0x0A
112 #define DIGIPOT3_USER10_EEMEM_LOC 0x0B
113 #define DIGIPOT3_USER11_EEMEM_LOC 0x0C
114 #define DIGIPOT3_USER12_EEMEM_LOC 0x0D
115 #define DIGIPOT3_USER13_EEMEM_LOC 0x0E
116 #define DIGIPOT3_USER14_EEMEM_LOC 0x0F
123 #define DIGIPOT3_ZERO_SCALE 0x0000
124 #define DIGIPOT3_QUARTER_SCALE 0x0100
125 #define DIGIPOT3_HALF_SCALE 0x0200
126 #define DIGIPOT3_THREE_QUARTERS_SCALE 0x0300
127 #define DIGIPOT3_FULL_SCALE 0x03FF
224 uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len );
290 #endif // _DIGIPOT3_H_
pin_name_t chip_select
Definition: digipot3.h:152
pin_name_t an
Definition: digipot3.h:170
void digipot3_cfg_setup(digipot3_cfg_t *cfg)
Config Object Initialization function.
spi_master_chip_select_polarity_t cs_polarity
Definition: digipot3.h:177
spi_master_mode_t spi_mode
Definition: digipot3.h:176
pin_name_t sck
Definition: digipot3.h:165
pin_name_t rdy
Definition: digipot3.h:171
digital_in_t an
Definition: digipot3.h:146
pin_name_t mosi
Definition: digipot3.h:164
spi_master_t spi
Definition: digipot3.h:151
void digipot2_generic_transfer(digipot3_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: digipot3.h:142
Click configuration structure definition.
Definition: digipot3.h:160
uint8_t digipot3_check_data_ready(digipot3_t *ctx)
Data Ready Check function.
Click ctx object definition.
Definition: digipot3.h:141
pin_name_t miso
Definition: digipot3.h:163
pin_name_t cs
Definition: digipot3.h:166
DIGIPOT3_RETVAL digipot3_init(digipot3_t *ctx, digipot3_cfg_t *cfg)
Initialization function.
uint32_t spi_speed
Definition: digipot3.h:175
digital_in_t rdy
Definition: digipot3.h:147
void digipot3_read_dac(digipot3_t *ctx, uint16_t *data_out)
DAC Read function.
uint8_t digipot3_write_dac(digipot3_t *ctx, uint16_t value_dac)
DAC Write function.
uint8_t digipot3_send_command(digipot3_t *ctx, uint8_t command_byte)
Command Send function.
uint8_t digipot3_read_eemem(digipot3_t *ctx, uint8_t location_address, uint16_t *data_out)
EEMEM Read function.
#define DIGIPOT3_RETVAL
Definition: digipot3.h:77
uint8_t digipot3_store_eemem(digipot3_t *ctx, uint8_t location_address, uint16_t transfer_data)
EEMEM Store function.