pwrmeter 2.0.0.0
Public function

Functions

void pwrmeter_cfg_setup (pwrmeter_cfg_t *cfg)
 Config Object Initialization function.
 
PWRMETER_RETVAL pwrmeter_init (pwrmeter_t *ctx, pwrmeter_cfg_t *cfg)
 Initialization function.
 
void pwrmeter_default_cfg (pwrmeter_t *ctx)
 Click Default Configuration function.
 
void pwrmeter_generic_write (pwrmeter_t *ctx, char *data_buf, uint16_t len)
 Generic write function.
 
int32_t pwrmeter_generic_read (pwrmeter_t *ctx, char *data_buf, uint16_t max_len)
 Generic read function.
 
PWRMETER_RETVAL pwrmeter_read_reg_bytes (pwrmeter_t *ctx, uint16_t reg_addr, uint8_t n_bytes, uint8_t *data_out)
 Bytes Read function.
 
PWRMETER_RETVAL pwrmeter_read_reg_word (pwrmeter_t *ctx, uint16_t register_addr, uint16_t *data_out)
 WORD Read function.
 
PWRMETER_RETVAL pwrmeter_read_reg_dword (pwrmeter_t *ctx, uint16_t register_addr, uint32_t *data_out)
 DWORD Read function.
 
PWRMETER_RETVAL pwrmeter_read_reg_signed (pwrmeter_t *ctx, uint16_t register_addr, uint8_t data_mode, int32_t *data_out)
 Signed Data Read function.
 
PWRMETER_RETVAL pwrmeter_write_reg_bytes (pwrmeter_t *ctx, uint16_t reg_addr, uint8_t n_bytes, uint8_t *data_in)
 Bytes Write function.
 
PWRMETER_RETVAL pwrmeter_write_reg_word (pwrmeter_t *ctx, uint16_t register_addr, uint16_t data_in)
 WORD Write function.
 
PWRMETER_RETVAL pwrmeter_write_reg_dword (pwrmeter_t *ctx, uint16_t register_addr, uint32_t data_in)
 DWORD Write function.
 
PWRMETER_RETVAL pwrmeter_write_reg_signed (pwrmeter_t *ctx, uint16_t register_addr, uint8_t data_mode, int32_t data_in)
 Signed Data Write function.
 
PWRMETER_RETVAL pwrmeter_send_command (pwrmeter_t *ctx, uint8_t command_byte)
 Command Send function.
 
PWRMETER_RETVAL pwrmeter_read_page_eeprom (pwrmeter_t *ctx, uint8_t page_num, uint16_t *data_out)
 EEPROM Read function.
 
PWRMETER_RETVAL pwrmeter_write_page_eeprom (pwrmeter_t *ctx, uint8_t page_num, uint16_t *data_in)
 EEPROM Write function.
 
PWRMETER_RETVAL pwrmeter_get_status (pwrmeter_t *ctx, uint8_t *status_data)
 Status Get function.
 
void pwrmeter_enable (pwrmeter_t *ctx, uint8_t state)
 Enable function.
 

Detailed Description

Function Documentation

◆ pwrmeter_cfg_setup()

void pwrmeter_cfg_setup ( pwrmeter_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.

◆ pwrmeter_default_cfg()

void pwrmeter_default_cfg ( pwrmeter_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for PwrMeter click.

◆ pwrmeter_enable()

void pwrmeter_enable ( pwrmeter_t * ctx,
uint8_t state )

Enable function.

Parameters
ctxClick object.
state0 - active state; 1 - inactive state

@description Function puts output of regulator in enabled or disabled state.

◆ pwrmeter_generic_read()

int32_t pwrmeter_generic_read ( pwrmeter_t * ctx,
char * data_buf,
uint16_t max_len )

Generic read function.

Parameters
ctxClick object.
pwrmeterClick object.
data_bufData buffer for read data.
max_lenThe maximum length of data that can be read.
Returns
Number of reads data.

@description Generic read function

◆ pwrmeter_generic_write()

void pwrmeter_generic_write ( pwrmeter_t * ctx,
char * data_buf,
uint16_t len )

Generic write function.

Parameters
ctxClick object.
pwrmeterClick object.
data_bufData buffer for sends.
lenNumber of bytes for sends.

@description Generic write function

◆ pwrmeter_get_status()

PWRMETER_RETVAL pwrmeter_get_status ( pwrmeter_t * ctx,
uint8_t * status_data )

Status Get function.

Parameters
ctxClick object.
status_dataStatus byte with determined status bits
Returns
Response on the desired command

@description Function reads 16-bit Status register and makes one byte with determined status bits, which can be useful in code.

Note
See status bit masks which can be find as constant global variables.

◆ pwrmeter_init()

PWRMETER_RETVAL pwrmeter_init ( pwrmeter_t * ctx,
pwrmeter_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ pwrmeter_read_page_eeprom()

PWRMETER_RETVAL pwrmeter_read_page_eeprom ( pwrmeter_t * ctx,
uint8_t page_num,
uint16_t * data_out )

EEPROM Read function.

Parameters
ctxClick object.
page_numPage number in EEPROM memory (from 0 to 31)
data_outMemory where data be stored
Returns
Response on the desired command

@description Function reads a 8 16bit data from EEPROM block determined by page number.

◆ pwrmeter_read_reg_bytes()

PWRMETER_RETVAL pwrmeter_read_reg_bytes ( pwrmeter_t * ctx,
uint16_t reg_addr,
uint8_t n_bytes,
uint8_t * data_out )

Bytes Read function.

Parameters
ctxClick object.
reg_addrStart address which from data be read
n_bytesNumber of bytes to be read
data_outMemory where data be stored
Returns
Response on the desired command

@description Function reads data bytes from registers.

◆ pwrmeter_read_reg_dword()

PWRMETER_RETVAL pwrmeter_read_reg_dword ( pwrmeter_t * ctx,
uint16_t register_addr,
uint32_t * data_out )

DWORD Read function.

Parameters
ctxClick object.
register_addrAddress which from data be read
data_outMemory where data be stored
Returns
Response on the desired command

@description Function reads 32-bit data from the desired register.

◆ pwrmeter_read_reg_signed()

PWRMETER_RETVAL pwrmeter_read_reg_signed ( pwrmeter_t * ctx,
uint16_t register_addr,
uint8_t data_mode,
int32_t * data_out )

Signed Data Read function.

Parameters
ctxClick object.
register_addrAddress which from data be read
data_mode0 - 16bit data, 1 - 32bit data
data_outMemory where data be stored
Returns
Response on the desired command

@description Function reads signed 16bit or 32bit data from the desired register.

◆ pwrmeter_read_reg_word()

PWRMETER_RETVAL pwrmeter_read_reg_word ( pwrmeter_t * ctx,
uint16_t register_addr,
uint16_t * data_out )

WORD Read function.

Parameters
ctxClick object.
register_addrAddress which from data be read
data_outMemory where data be stored
Returns
Response on the desired command

@description Function reads 16-bit data from the desired register.

◆ pwrmeter_send_command()

PWRMETER_RETVAL pwrmeter_send_command ( pwrmeter_t * ctx,
uint8_t command_byte )

Command Send function.

Parameters
ctxClick object.
command_byteCommand to be sent
Returns
Response on the desired command

@description Function sends and performs a determined command.

◆ pwrmeter_write_page_eeprom()

PWRMETER_RETVAL pwrmeter_write_page_eeprom ( pwrmeter_t * ctx,
uint8_t page_num,
uint16_t * data_in )

EEPROM Write function.

Parameters
ctxClick object.
page_numPage number in EEPROM memory (from 2 to 31)
data_inData to be written
Returns
Response on the desired command

@description Function writes 8 16bit data to the EEPROM block determined by page number.

◆ pwrmeter_write_reg_bytes()

PWRMETER_RETVAL pwrmeter_write_reg_bytes ( pwrmeter_t * ctx,
uint16_t reg_addr,
uint8_t n_bytes,
uint8_t * data_in )

Bytes Write function.

Parameters
ctxClick object.
reg_addrAddress where data be written
n_bytesNumber of bytes to be written
data_inData bytes to be written
Returns
Response on the desired command

@description Function writes bytes to the registers.

◆ pwrmeter_write_reg_dword()

PWRMETER_RETVAL pwrmeter_write_reg_dword ( pwrmeter_t * ctx,
uint16_t register_addr,
uint32_t data_in )

DWORD Write function.

Parameters
ctxClick object.
register_addrAddress where data be written
data_inData to be written
Returns
Response on the desired command

@description Function writes 32-bit data to the register.

◆ pwrmeter_write_reg_signed()

PWRMETER_RETVAL pwrmeter_write_reg_signed ( pwrmeter_t * ctx,
uint16_t register_addr,
uint8_t data_mode,
int32_t data_in )

Signed Data Write function.

Parameters
ctxClick object.
register_addrAddress where data be written
data_mode0 - 16bit data, 1 - 32bit data
data_inData to be written
Returns
Response on the desired command

@description Function writes 16bit or 32bit signed data to the register.

◆ pwrmeter_write_reg_word()

PWRMETER_RETVAL pwrmeter_write_reg_word ( pwrmeter_t * ctx,
uint16_t register_addr,
uint16_t data_in )

WORD Write function.

Parameters
ctxClick object.
register_addrAddress where data be written
data_inData to be written
Returns
Response on the desired command

@description Function writes 16-bit data to the register.