cdc 2.1.0.0
cdc.h File Reference

This file contains API for CDC Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  cdc_s
 CDC Click context object. More...
 
struct  cdc_cfg_t
 CDC Click configuration object. More...
 
struct  cdc_results_t
 CDC Click results object. More...
 

Macros

#define CDC_OPCODE_WR_MEM   0xA0
 CDC opcodes list.
 
#define CDC_OPCODE_RD_MEM   0x20
 
#define CDC_OPCODE_RD_RES   0x40
 
#define CDC_OPCODE_POR   0x88
 
#define CDC_OPCODE_INITIALIZE   0x8A
 
#define CDC_OPCODE_CDC_START   0x8C
 
#define CDC_OPCODE_RDC_START   0x8E
 
#define CDC_OPCODE_DSP_TRIG   0x8D
 
#define CDC_OPCODE_NV_STORE   0x96
 
#define CDC_OPCODE_NV_RECALL   0x99
 
#define CDC_OPCODE_NV_ERASE   0x9C
 
#define CDC_OPCODE_TEST_READ   0x7E
 
#define CDC_REG_CFG0   0x00
 CDC config registers list.
 
#define CDC_REG_CFG1   0x01
 
#define CDC_REG_CFG2   0x02
 
#define CDC_REG_CFG3   0x03
 
#define CDC_REG_CFG4   0x04
 
#define CDC_REG_CFG5   0x05
 
#define CDC_REG_CFG6   0x06
 
#define CDC_REG_CFG7   0x07
 
#define CDC_REG_CFG8   0x08
 
#define CDC_REG_CFG9   0x09
 
#define CDC_REG_CFG10   0x0A
 
#define CDC_REG_CFG11   0x0B
 
#define CDC_REG_CFG12   0x0C
 
#define CDC_REG_CFG13   0x0D
 
#define CDC_REG_CFG14   0x0E
 
#define CDC_REG_CFG15   0x0F
 
#define CDC_REG_CFG16   0x10
 
#define CDC_REG_CFG17   0x11
 
#define CDC_REG_CFG18   0x12
 
#define CDC_REG_CFG19   0x13
 
#define CDC_REG_CFG20   0x14
 
#define CDC_REG_CFG21   0x15
 
#define CDC_REG_CFG22   0x16
 
#define CDC_REG_CFG23   0x17
 
#define CDC_REG_CFG24   0x18
 
#define CDC_REG_CFG25   0x19
 
#define CDC_REG_CFG26   0x1A
 
#define CDC_REG_CFG27   0x1B
 
#define CDC_REG_CFG28   0x1C
 
#define CDC_REG_CFG29   0x1D
 
#define CDC_REG_CFG30   0x1E
 
#define CDC_REG_CFG31   0x1F
 
#define CDC_REG_CFG32   0x20
 
#define CDC_REG_CFG33   0x21
 
#define CDC_REG_CFG34   0x22
 
#define CDC_REG_CFG35   0x23
 
#define CDC_REG_CFG38   0x26
 
#define CDC_REG_CFG39   0x27
 
#define CDC_REG_CFG40   0x28
 
#define CDC_REG_CFG41   0x29
 
#define CDC_REG_CFG42   0x2A
 
#define CDC_REG_CFG47   0x2F
 
#define CDC_REG_CFG48   0x30
 
#define CDC_REG_CFG49   0x31
 
#define CDC_REG_CFG50   0x32
 
#define CDC_REG_CFG54   0x36
 
#define CDC_REG_CFG62   0x3E
 
#define CDC_REG_CFG63   0x3F
 
#define CDC_REG_RES0   0x00
 CDC result registers list.
 
#define CDC_REG_RES1   0x04
 
#define CDC_REG_RES2   0x08
 
#define CDC_REG_RES3   0x0C
 
#define CDC_REG_RES4   0x10
 
#define CDC_REG_RES5   0x14
 
#define CDC_REG_RES6   0x18
 
#define CDC_REG_RES7   0x1C
 
#define CDC_REG_STATUS_0   0x20
 
#define CDC_REG_STATUS_1   0x21
 
#define CDC_REG_STATUS_2   0x22
 
#define CDC_MEM_ADDRESS_START   0x0000u
 CDC memory address setting.
 
#define CDC_MEM_ADDRESS_END   0x03FFu
 
#define CDC_MEM_ADDRESS_CFG_OFFSET   0x03C0u
 
#define CDC_MEM_ADDRESS_WR_BLOCK_SIZE   64
 
#define CDC_FIXED_POINT_NUM_FRACTIONAL   27
 CDC fixed-point result setting.
 
#define CDC_TEST_READ_RES   0x11
 CDC test read result setting.
 
#define CDC_DEVICE_ADDRESS   0x28
 CDC device address setting.
 
#define CDC_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define CDC_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define CDC_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef struct cdc_s cdc_t
 CDC Click context object.
 

Enumerations

enum  cdc_drv_t { CDC_DRV_SEL_SPI , CDC_DRV_SEL_I2C }
 CDC Click driver selector. More...
 
enum  cdc_return_value_t { CDC_OK = 0 , CDC_ERROR = -1 }
 CDC Click return value data. More...
 

Functions

void cdc_cfg_setup (cdc_cfg_t *cfg)
 CDC configuration object setup function.
 
void cdc_drv_interface_sel (cdc_cfg_t *cfg, cdc_drv_t drv_sel)
 CDC driver interface setup function.
 
err_t cdc_init (cdc_t *ctx, cdc_cfg_t *cfg)
 CDC initialization function.
 
err_t cdc_default_cfg (cdc_t *ctx)
 CDC default configuration function.
 
err_t cdc_write_memory (cdc_t *ctx, uint16_t address, const uint8_t *data_in, uint16_t len)
 CDC write memory function.
 
err_t cdc_read_memory (cdc_t *ctx, uint16_t address, uint8_t *data_out, uint16_t len)
 CDC read memory function.
 
err_t cdc_write_config (cdc_t *ctx, uint8_t address, const uint8_t *data_in, uint8_t len)
 CDC write config function.
 
err_t cdc_read_config (cdc_t *ctx, uint8_t address, uint8_t *data_out, uint8_t len)
 CDC read config function.
 
err_t cdc_read_result (cdc_t *ctx, uint8_t address, uint8_t *data_out, uint8_t len)
 CDC read result function.
 
err_t cdc_send_opcode (cdc_t *ctx, uint8_t opcode)
 CDC send opcode function.
 
err_t cdc_check_communication (cdc_t *ctx)
 CDC check communication function.
 
err_t cdc_read_results (cdc_t *ctx, cdc_results_t *results)
 CDC read results function.
 

Detailed Description

This file contains API for CDC Click Driver.

Typedef Documentation

◆ cdc_t

typedef struct cdc_s cdc_t

CDC Click context object.

Context object definition of CDC Click driver.

Enumeration Type Documentation

◆ cdc_drv_t

enum cdc_drv_t

CDC Click driver selector.

Selects target driver interface of CDC Click driver.

Enumerator
CDC_DRV_SEL_SPI 

SPI driver descriptor.

CDC_DRV_SEL_I2C 

I2C driver descriptor.

◆ cdc_return_value_t

CDC Click return value data.

Predefined enum values for driver return values.

Enumerator
CDC_OK 
CDC_ERROR