38 #include "drv_digital_out.h" 39 #include "drv_digital_in.h" 40 #include "drv_spi_master.h" 54 #define DIGIPOT3_MAP_MIKROBUS( cfg, mikrobus ) \ 55 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \ 56 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \ 57 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \ 58 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \ 59 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \ 60 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT ); 67 #define DIGIPOT3_RETVAL uint8_t 69 #define DIGIPOT3_OK 0x00 70 #define DIGIPOT3_INIT_ERROR 0xFF 77 #define DIGIPOT3_DO_NOTHING_COMM 0x00 78 #define DIGIPOT3_RESTORE_EEMEM_TO_RDAC_COMM 0x01 79 #define DIGIPOT3_STORE_RDAC_TO_EEMEM_COMM 0x02 80 #define DIGIPOT3_DECREMENT_RDAC_6DB_COMM 0x04 81 #define DIGIPOT3_DECREMENT_RDAC_ONESTEP_COMM 0x06 82 #define DIGIPOT3_RESTORE_RDAC_WITH_EEMEM_COMM 0x08 83 #define DIGIPOT3_INCREMENT_RDAC_6DB_COMM 0x0C 84 #define DIGIPOT3_INCREMENT_RDAC_ONESTEP_COMM 0x0E 91 #define DIGIPOT3_RDAC_EEMEM_LOC 0x00 92 #define DIGIPOT3_O1_O2_EEMEM_LOC 0x01 93 #define DIGIPOT3_USER1_EEMEM_LOC 0x02 94 #define DIGIPOT3_USER2_EEMEM_LOC 0x03 95 #define DIGIPOT3_USER3_EEMEM_LOC 0x04 96 #define DIGIPOT3_USER4_EEMEM_LOC 0x05 97 #define DIGIPOT3_USER5_EEMEM_LOC 0x06 98 #define DIGIPOT3_USER6_EEMEM_LOC 0x07 99 #define DIGIPOT3_USER7_EEMEM_LOC 0x08 100 #define DIGIPOT3_USER8_EEMEM_LOC 0x09 101 #define DIGIPOT3_USER9_EEMEM_LOC 0x0A 102 #define DIGIPOT3_USER10_EEMEM_LOC 0x0B 103 #define DIGIPOT3_USER11_EEMEM_LOC 0x0C 104 #define DIGIPOT3_USER12_EEMEM_LOC 0x0D 105 #define DIGIPOT3_USER13_EEMEM_LOC 0x0E 106 #define DIGIPOT3_USER14_EEMEM_LOC 0x0F 113 #define DIGIPOT3_ZERO_SCALE 0x0000 114 #define DIGIPOT3_QUARTER_SCALE 0x0100 115 #define DIGIPOT3_HALF_SCALE 0x0200 116 #define DIGIPOT3_THREE_QUARTERS_SCALE 0x0300 117 #define DIGIPOT3_FULL_SCALE 0x03FF 214 uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len );
280 #endif // _DIGIPOT3_H_ spi_master_t spi
Definition: digipot3.h:141
pin_name_t an
Definition: digipot3.h:160
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.
DIGIPOT3_RETVAL digipot3_init(digipot3_t *ctx, digipot3_cfg_t *cfg)
Initialization function.
pin_name_t sck
Definition: digipot3.h:155
digital_in_t an
Definition: digipot3.h:136
uint8_t digipot3_write_dac(digipot3_t *ctx, uint16_t value_dac)
DAC Write function.
Click ctx object definition.
Definition: digipot3.h:130
uint8_t digipot3_store_eemem(digipot3_t *ctx, uint8_t location_address, uint16_t transfer_data)
EEMEM Store function.
pin_name_t rdy
Definition: digipot3.h:161
pin_name_t mosi
Definition: digipot3.h:154
uint8_t digipot3_check_data_ready(digipot3_t *ctx)
Data Ready Check function.
void digipot3_cfg_setup(digipot3_cfg_t *cfg)
Config Object Initialization function.
void digipot3_read_dac(digipot3_t *ctx, uint16_t *data_out)
DAC Read function.
uint8_t digipot3_read_eemem(digipot3_t *ctx, uint8_t location_address, uint16_t *data_out)
EEMEM Read function.
uint8_t digipot3_send_command(digipot3_t *ctx, uint8_t command_byte)
Command Send function.
pin_name_t cs
Definition: digipot3.h:156
Click configuration structure definition.
Definition: digipot3.h:149
uint32_t spi_speed
Definition: digipot3.h:165
#define DIGIPOT3_RETVAL
Definition: digipot3.h:67
pin_name_t miso
Definition: digipot3.h:153
pin_name_t chip_select
Definition: digipot3.h:142
digital_in_t rdy
Definition: digipot3.h:137
digital_out_t cs
Definition: digipot3.h:132
spi_master_mode_t spi_mode
Definition: digipot3.h:166
spi_master_chip_select_polarity_t cs_polarity
Definition: digipot3.h:167