digipot12 2.1.0.0
digipot12.h File Reference

This file contains API for DIGI POT 12 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  digipot12_t
 DIGI POT 12 Click context object. More...
 
struct  digipot12_cfg_t
 DIGI POT 12 Click configuration object. More...
 

Macros

#define DIGIPOT12_CTRL_BIT_NOP   0x00
 DIGI POT 12 description control bits.
 
#define DIGIPOT12_CTRL_BIT_WRITE_RDAC   0x10
 
#define DIGIPOT12_CTRL_BIT_WRITE_SHIFT_REG   0x20
 
#define DIGIPOT12_CTRL_BIT_READ   0x30
 
#define DIGIPOT12_CTRL_BIT_LIN_RDAC   0x40
 
#define DIGIPOT12_CTRL_BIT_6_DB_RDAC   0x50
 
#define DIGIPOT12_CTRL_BIT_COPY_LRDAC   0x60
 
#define DIGIPOT12_CTRL_BIT_COPY_RDAC_EEPROM   0x70
 
#define DIGIPOT12_CTRL_BIT_WRITE_EEPROM   0x80
 
#define DIGIPOT12_CTRL_BIT_SCALE   0x90
 
#define DIGIPOT12_CTRL_BIT_SW_RST   0xB0
 
#define DIGIPOT12_CTRL_BIT_SW_SHDN   0xC0
 
#define DIGIPOT12_CTRL_BIT_REG_CTRL   0xD0
 
#define DIGIPOT12_CTRL_BIT_MASK   0xF0
 
#define DIGIPOT12_ADDR_BIT_RDAC1   0x00
 DIGI POT 12 description address bits.
 
#define DIGIPOT12_ADDR_BIT_RDAC2   0x01
 
#define DIGIPOT12_ADDR_BIT_ALL_CHANNELS   0x08
 
#define DIGIPOT12_WIPER_SEL_1   0x00
 DIGI POT 12 description of the wiper selection.
 
#define DIGIPOT12_WIPER_SEL_2   0x01
 
#define DIGIPOT12_WIPER_SEL_BOTH   0x08
 
#define DIGIPOT12_ADDR_BIT_READ_INPUT_REG   0x00
 DIGI POT 12 description mask data bits.
 
#define DIGIPOT12_ADDR_BIT_READ_EEPROM   0x01
 
#define DIGIPOT12_ADDR_BIT_READ_CTRL_REG   0x02
 
#define DIGIPOT12_ADDR_BIT_READ_RDAC   0x03
 
#define DIGIPOT12_ADDR_BIT_RDAC_DECR   0x00
 
#define DIGIPOT12_ADDR_BIT_RDAC_INCR   0x01
 
#define DIGIPOT12_ADDR_BIT_COPY_TO_RDAC   0x00
 
#define DIGIPOT12_ADDR_BIT_COPY_TO_EEPROM   0x01
 
#define DIGIPOT12_ADDR_BIT_SCALE_MODE_NORMAL   0x80
 
#define DIGIPOT12_ADDR_BIT_SCALE_MODE_SHDN   0x81
 
#define DIGIPOT12_ADDR_BIT_SCALE_EXIT   0x00
 
#define DIGIPOT12_ADDR_BIT_SCALE_ENTER   0x01
 
#define DIGIPOT12_ADDR_BIT_SW_SHDN_MODE_NORMAL   0x00
 
#define DIGIPOT12_ADDR_BIT_SW_SHDN_MODE_SHDN   0x01
 
#define DIGIPOT12_CTRL_REG_WIPER_POS_FROZEN   0x00
 DIGI POT 12 control register bit descriptions.
 
#define DIGIPOT12_CTRL_REG_UPDATE_WIPER_POS   0x01
 
#define DIGIPOT12_CTRL_REG_EEPROM_PROGRAM_DISABLE   0x00
 
#define DIGIPOT12_CTRL_REG_EEPROM_PROGRAM_ENABLE   0x02
 
#define DIGIPOT12_CTRL_REG_MODE_POTENTIOMETER   0x00
 
#define DIGIPOT12_CTRL_REG_MODE_LINEAR_GAIN   0x04
 
#define DIGIPOT12_CTRL_REG_MODE_BURST_DISABLE   0x00
 
#define DIGIPOT12_CTRL_REG_MODE_BURST_ENABLE   0x08
 
#define DIGIPOT12_WIPER_POS_MAX   255
 DIGI POT 12 wiper and resistance data values.
 
#define DIGIPOT12_WIPER_POS_MIN   0
 
#define DIGIPOT12_WIPER_POS_MIDDLE   127
 
#define DIGIPOT12_RES_10_KOHM   10
 
#define DIGIPOT12_RES_0_KOHM   0
 
#define DIGIPOT12_DEVICE_ADDRESS_0   0x2F
 DIGI POT 12 device address setting.
 
#define DIGIPOT12_DEVICE_ADDRESS_1   0x2C
 
#define DIGIPOT12_DEVICE_ADDRESS_2   0x23
 
#define DIGIPOT12_DEVICE_ADDRESS_3   0x20
 
#define DIGIPOT12_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  digipot12_return_value_t { DIGIPOT12_OK = 0 , DIGIPOT12_ERROR = -1 }
 DIGI POT 12 Click return value data. More...
 

Functions

void digipot12_cfg_setup (digipot12_cfg_t *cfg)
 DIGI POT 12 configuration object setup function.
 
err_t digipot12_init (digipot12_t *ctx, digipot12_cfg_t *cfg)
 DIGI POT 12 initialization function.
 
err_t digipot12_default_cfg (digipot12_t *ctx)
 DIGI POT 12 default configuration function.
 
void digipot12_device_enable (digipot12_t *ctx)
 DIGI POT 12 enable the device function.
 
void digipot12_hw_reset (digipot12_t *ctx)
 DIGI POT 12 hardware reset function.
 
err_t digipot12_write_data (digipot12_t *ctx, uint8_t ctrl, uint8_t addr, uint8_t data_in)
 DIGI POT 12 I2C writing function.
 
err_t digipot12_read_data (digipot12_t *ctx, uint8_t addr, uint8_t mask, uint8_t *data_out)
 DIGI POT 12 I2C reading function.
 
err_t digipot12_write_rdac (digipot12_t *ctx, uint8_t addr, uint8_t data_in)
 DIGI POT 12 write the RDAC function.
 
err_t digipot12_read_rdac (digipot12_t *ctx, uint8_t addr, uint8_t *data_out)
 DIGI POT 12 read the RDAC function.
 
err_t digipot12_set_wiper_1 (digipot12_t *ctx, uint8_t wiper_pos)
 DIGI POT 12 set wiper 1 function.
 
err_t digipot12_set_wiper_2 (digipot12_t *ctx, uint8_t wiper_pos)
 DIGI POT 12 set wiper 2 function.
 
err_t digipot12_set_resistance (digipot12_t *ctx, uint8_t wiper_sel, float res_kohm)
 DIGI POT 12 set the resistance function.
 
err_t digipot12_get_resistance (digipot12_t *ctx, uint8_t wiper_sel, float *res_kohm)
 DIGI POT 12 get the resistance function.
 

Detailed Description

This file contains API for DIGI POT 12 Click Driver.

Enumeration Type Documentation

◆ digipot12_return_value_t

DIGI POT 12 Click return value data.

Predefined enum values for driver return values.

Enumerator
DIGIPOT12_OK 
DIGIPOT12_ERROR