magneto 2.0.0.0
Public function

Functions

void magneto_cfg_setup (magneto_cfg_t *cfg)
 Config Object Initialization function.
 
MAGNETO_RETVAL magneto_init (magneto_t *ctx, magneto_cfg_t *cfg)
 Initialization function.
 
void magneto_generic_transfer (magneto_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
uint16_t magneto_read_data (magneto_t *ctx, uint16_t address_command)
 16-bit command generic read function.
 
void magneto_write_data (magneto_t *ctx, uint16_t address_command, uint16_t write_data)
 16-bit command generic write function.
 
uint16_t magneto_get_state (magneto_t *ctx)
 Get state function.
 
uint8_t magneto_check_state (magneto_t *ctx)
 Check state function.
 
float magneto_get_angle (magneto_t *ctx)
 Calculate angle function.
 

Detailed Description

Function Documentation

◆ magneto_cfg_setup()

void magneto_cfg_setup ( magneto_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.

◆ magneto_check_state()

uint8_t magneto_check_state ( magneto_t * ctx)

Check state function.

Parameters
ctxClick object.
Returns
8-bit data containing flags.

Flag state:

0 = MAGNETO_FLAG_OK 1 = MAGNETO_FLAG_ERROR pre

@description This function check and returns 0 or 1.

◆ magneto_generic_transfer()

void magneto_generic_transfer ( magneto_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

◆ magneto_get_angle()

float magneto_get_angle ( magneto_t * ctx)

Calculate angle function.

Parameters
ctxClick object.
Returns
Float value of angle.

@description This function read the 16-bit data from register then calculate and convert to float angle value from 0deg to 360deg.

◆ magneto_get_state()

uint16_t magneto_get_state ( magneto_t * ctx)

Get state function.

Parameters
ctxClick object.
Returns
16-bit data containing flags.

@description This function read and returns the value of the state register.

◆ magneto_init()

MAGNETO_RETVAL magneto_init ( magneto_t * ctx,
magneto_cfg_t * cfg )

Initialization function.

Parameters
magnetoClick object.
cfgClick configuration structure.

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

◆ magneto_read_data()

uint16_t magneto_read_data ( magneto_t * ctx,
uint16_t address_command )

16-bit command generic read function.

Parameters
ctxClick object.
address_command14-bit command address.
Returns
14-bit read data.

@description This function takes 16-bit address commnand of the target register to be written to that register.

◆ magneto_write_data()

void magneto_write_data ( magneto_t * ctx,
uint16_t address_command,
uint16_t write_data )

16-bit command generic write function.

Parameters
ctxClick object.
address_command14-bit command address.
write_data14-bit data to write.

@description This function takes 16-bit address commnand of the target register and the 16-bit write data to be written to that register.