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_digital_in.h"
47 #include "drv_i2c_master.h"
48 #include "drv_spi_master.h"
71 #define CDC_OPCODE_WR_MEM 0xA0
72 #define CDC_OPCODE_RD_MEM 0x20
73 #define CDC_OPCODE_RD_RES 0x40
74 #define CDC_OPCODE_POR 0x88
75 #define CDC_OPCODE_INITIALIZE 0x8A
76 #define CDC_OPCODE_CDC_START 0x8C
77 #define CDC_OPCODE_RDC_START 0x8E
78 #define CDC_OPCODE_DSP_TRIG 0x8D
79 #define CDC_OPCODE_NV_STORE 0x96
80 #define CDC_OPCODE_NV_RECALL 0x99
81 #define CDC_OPCODE_NV_ERASE 0x9C
82 #define CDC_OPCODE_TEST_READ 0x7E
87 #define CDC_REG_CFG0 0x00
88 #define CDC_REG_CFG1 0x01
89 #define CDC_REG_CFG2 0x02
90 #define CDC_REG_CFG3 0x03
91 #define CDC_REG_CFG4 0x04
92 #define CDC_REG_CFG5 0x05
93 #define CDC_REG_CFG6 0x06
94 #define CDC_REG_CFG7 0x07
95 #define CDC_REG_CFG8 0x08
96 #define CDC_REG_CFG9 0x09
97 #define CDC_REG_CFG10 0x0A
98 #define CDC_REG_CFG11 0x0B
99 #define CDC_REG_CFG12 0x0C
100 #define CDC_REG_CFG13 0x0D
101 #define CDC_REG_CFG14 0x0E
102 #define CDC_REG_CFG15 0x0F
103 #define CDC_REG_CFG16 0x10
104 #define CDC_REG_CFG17 0x11
105 #define CDC_REG_CFG18 0x12
106 #define CDC_REG_CFG19 0x13
107 #define CDC_REG_CFG20 0x14
108 #define CDC_REG_CFG21 0x15
109 #define CDC_REG_CFG22 0x16
110 #define CDC_REG_CFG23 0x17
111 #define CDC_REG_CFG24 0x18
112 #define CDC_REG_CFG25 0x19
113 #define CDC_REG_CFG26 0x1A
114 #define CDC_REG_CFG27 0x1B
115 #define CDC_REG_CFG28 0x1C
116 #define CDC_REG_CFG29 0x1D
117 #define CDC_REG_CFG30 0x1E
118 #define CDC_REG_CFG31 0x1F
119 #define CDC_REG_CFG32 0x20
120 #define CDC_REG_CFG33 0x21
121 #define CDC_REG_CFG34 0x22
122 #define CDC_REG_CFG35 0x23
123 #define CDC_REG_CFG38 0x26
124 #define CDC_REG_CFG39 0x27
125 #define CDC_REG_CFG40 0x28
126 #define CDC_REG_CFG41 0x29
127 #define CDC_REG_CFG42 0x2A
128 #define CDC_REG_CFG47 0x2F
129 #define CDC_REG_CFG48 0x30
130 #define CDC_REG_CFG49 0x31
131 #define CDC_REG_CFG50 0x32
132 #define CDC_REG_CFG54 0x36
133 #define CDC_REG_CFG62 0x3E
134 #define CDC_REG_CFG63 0x3F
140 #define CDC_REG_RES0 0x00
141 #define CDC_REG_RES1 0x04
142 #define CDC_REG_RES2 0x08
143 #define CDC_REG_RES3 0x0C
144 #define CDC_REG_RES4 0x10
145 #define CDC_REG_RES5 0x14
146 #define CDC_REG_RES6 0x18
147 #define CDC_REG_RES7 0x1C
148 #define CDC_REG_STATUS_0 0x20
149 #define CDC_REG_STATUS_1 0x21
150 #define CDC_REG_STATUS_2 0x22
168 #define CDC_MEM_ADDRESS_START 0x0000u
169 #define CDC_MEM_ADDRESS_END 0x03FFu
170 #define CDC_MEM_ADDRESS_CFG_OFFSET 0x03C0u
171 #define CDC_MEM_ADDRESS_WR_BLOCK_SIZE 64
177 #define CDC_FIXED_POINT_NUM_FRACTIONAL 27
183 #define CDC_TEST_READ_RES 0x11
190 #define CDC_DEVICE_ADDRESS 0x28
200 #define CDC_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
201 #define CDC_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
219 #define CDC_MAP_MIKROBUS( cfg, mikrobus ) \
220 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
221 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
222 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
223 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
224 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
225 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
226 cfg.sis = MIKROBUS( mikrobus, MIKROBUS_AN );
struct cdc_s cdc_t
CDC Click context object.
uint8_t status_0
Definition: cdc.h:298
digital_out_t sis
Definition: cdc.h:248
err_t cdc_read_config(cdc_t *ctx, uint8_t address, uint8_t *data_out, uint8_t len)
CDC read config function.
pin_name_t scl
Definition: cdc.h:265
uint32_t i2c_speed
Definition: cdc.h:273
pin_name_t sda
Definition: cdc.h:266
err_t cdc_send_opcode(cdc_t *ctx, uint8_t opcode)
CDC send opcode function.
@ CDC_DRV_SEL_I2C
Definition: cdc.h:238
This file contains SPI specific macros, functions, etc.
float res_7
Definition: cdc.h:297
float res_4
Definition: cdc.h:294
@ CDC_DRV_SEL_SPI
Definition: cdc.h:237
cdc_return_value_t
CDC Click return value data.
Definition: cdc.h:309
CDC Click results object.
Definition: cdc.h:289
err_t cdc_write_memory(cdc_t *ctx, uint16_t address, const uint8_t *data_in, uint16_t len)
CDC write memory function.
pin_name_t cs
Definition: cdc.h:270
pin_name_t sck
Definition: cdc.h:269
spi_master_chip_select_polarity_t cs_polarity
Definition: cdc.h:278
pin_name_t sis
Definition: cdc.h:271
CDC Click context object.
Definition: cdc.h:247
err_t cdc_default_cfg(cdc_t *ctx)
CDC default configuration function.
err_t cdc_read_results(cdc_t *ctx, cdc_results_t *results)
CDC read results function.
float res_3
Definition: cdc.h:293
pin_name_t mosi
Definition: cdc.h:268
@ CDC_ERROR
Definition: cdc.h:311
pin_name_t chip_select
Definition: cdc.h:254
cdc_drv_t drv_sel
Definition: cdc.h:255
i2c_master_t i2c
Definition: cdc.h:250
@ CDC_OK
Definition: cdc.h:310
uint8_t i2c_address
Definition: cdc.h:274
void cdc_drv_interface_sel(cdc_cfg_t *cfg, cdc_drv_t drv_sel)
CDC driver interface setup function.
float res_1
Definition: cdc.h:291
float res_5
Definition: cdc.h:295
pin_name_t miso
Definition: cdc.h:267
spi_master_t spi
Definition: cdc.h:251
uint8_t status_2
Definition: cdc.h:300
err_t cdc_init(cdc_t *ctx, cdc_cfg_t *cfg)
CDC initialization function.
uint8_t status_1
Definition: cdc.h:299
err_t cdc_check_communication(cdc_t *ctx)
CDC check communication function.
cdc_drv_t
CDC Click driver selector.
Definition: cdc.h:236
spi_master_mode_t spi_mode
Definition: cdc.h:277
err_t cdc_read_result(cdc_t *ctx, uint8_t address, uint8_t *data_out, uint8_t len)
CDC read result function.
uint8_t slave_address
Definition: cdc.h:253
cdc_drv_t drv_sel
Definition: cdc.h:280
float res_6
Definition: cdc.h:296
float res_2
Definition: cdc.h:292
err_t cdc_read_memory(cdc_t *ctx, uint16_t address, uint8_t *data_out, uint16_t len)
CDC read memory function.
float res_0
Definition: cdc.h:290
CDC Click configuration object.
Definition: cdc.h:264
err_t cdc_write_config(cdc_t *ctx, uint8_t address, const uint8_t *data_in, uint8_t len)
CDC write config function.
uint32_t spi_speed
Definition: cdc.h:276
void cdc_cfg_setup(cdc_cfg_t *cfg)
CDC configuration object setup function.