mcp73213 2.0.0.0
Public function

Functions

void mcp73213_cfg_setup (mcp73213_cfg_t *cfg)
 Config Object Initialization function.
 
MCP73213_RETVAL mcp73213_init (mcp73213_t *ctx, mcp73213_cfg_t *cfg)
 Initialization function.
 
void mcp73213_generic_transfer (mcp73213_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
void mcp73213_write_data (mcp73213_t *ctx, uint8_t command, uint8_t write_data)
 Generic write 8-bit data function.
 
uint8_t mcp73213_read_data (mcp73213_t *ctx, uint8_t command)
 Generic read 8-bit data function.
 
void mcp73213_set_current_output (mcp73213_t *ctx, uint8_t out_data)
 Set values for output current function.
 
uint8_t mcp73213_get_status (mcp73213_t *ctx)
 Get the status register data function.
 
float mcp73213_convert_output (uint8_t value_adc, float v_ref)
 Convert ADC value to volatage.
 

Detailed Description

Function Documentation

◆ mcp73213_cfg_setup()

void mcp73213_cfg_setup ( mcp73213_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ mcp73213_convert_output()

float mcp73213_convert_output ( uint8_t value_adc,
float v_ref )

Convert ADC value to volatage.

Parameters
ctxClick object.
value_adc10-bit ADC value
v_refVoltage Reference 3.3V or 5V
Returns
float voltage ( 0V - 3.3V ) or ( 0V - 5.0V )

@description Convert 8-bit ADC value to volatage of on MCP73213 Click board.

◆ mcp73213_generic_transfer()

void mcp73213_generic_transfer ( mcp73213_t * ctx,
uint8_t * wr_buf,
uint16_t wr_len,
uint8_t * rd_buf,
uint16_t rd_len )

Generic transfer function.

Parameters
ctxClick object.
wr_bufWrite data buffer
wr_lenNumber of byte in write data buffer
rd_bufRead data buffer
rd_lenNumber of byte in read data buffer

@description Generic SPI transfer, for sending and receiving packages

◆ mcp73213_get_status()

uint8_t mcp73213_get_status ( mcp73213_t * ctx)

Get the status register data function.

Parameters
ctxClick object.
Returns
8-bit data from status register

@description Function get 8-bit status data from status register on the MCP4161 chip register on MCP73213 Click board.

◆ mcp73213_init()

MCP73213_RETVAL mcp73213_init ( mcp73213_t * ctx,
mcp73213_cfg_t * cfg )

Initialization function.

Parameters
mcp73213Click object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ mcp73213_read_data()

uint8_t mcp73213_read_data ( mcp73213_t * ctx,
uint8_t command )

Generic read 8-bit data function.

Parameters
ctxClick object.
command8-bit data address command
Returns
8-bit data from address command register

@description Function read 8-bit data from address command register on the MCP4161 chip register on MCP73213 Click board.

◆ mcp73213_set_current_output()

void mcp73213_set_current_output ( mcp73213_t * ctx,
uint8_t out_data )

Set values for output current function.

Parameters
ctxClick object.
out_data8-bit current output value

@description Function set values for output current by write outData to the MCP4161 chip register on MCP73213 Click board.

◆ mcp73213_write_data()

void mcp73213_write_data ( mcp73213_t * ctx,
uint8_t command,
uint8_t write_data )

Generic write 8-bit data function.

Parameters
ctxClick object.
command8-bit data address command
write_data8-bit data to write

@description Function write 8-bit data via SPI on the MCP4161 chip register on MCP73213 Click board.