magneto4 2.0.0.0
Public function

Functions

void magneto4_cfg_setup (magneto4_cfg_t *cfg)
 Config Object Initialization function.
 
MAGNETO4_RETVAL magneto4_init (magneto4_t *ctx, magneto4_cfg_t *cfg)
 Initialization function.
 
void magneto4_default_cfg (magneto4_t *ctx)
 Click Default Configuration function.
 
void magneto4_generic_transfer (magneto4_t *ctx, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
uint8_t magneto4_get_out_a (magneto4_t *ctx)
 Get A ( AN ) pin status.
 
uint8_t magneto4_get_out_b (magneto4_t *ctx)
 Get B ( RST ) pin status.
 
uint8_t magneto4_get_index (magneto4_t *ctx)
 Get IND ( interrupt ) pin status.
 
uint32_t magneto4_start_measurement (magneto4_t *ctx)
 Measurement function.
 
uint16_t magneto4_get_magnetic_field (magneto4_t *ctx)
 Measurement Field.
 
uint8_t magneto4_get_magnetic_status (magneto4_t *ctx, mag_status_t *mag_status)
 Get Magnetic measurement status.
 
uint8_t magneto4_get_encoder_direction (magneto4_t *ctx)
 Encoder direction.
 
void magneto4_get_encoder_position (magneto4_t *ctx)
 Encoder position.
 
void magneto4_set_start_position (magneto4_t *ctx, int32_t encoder_pos)
 Set start encoder position.
 

Detailed Description

Function Documentation

◆ magneto4_cfg_setup()

void magneto4_cfg_setup ( magneto4_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.

◆ magneto4_default_cfg()

void magneto4_default_cfg ( magneto4_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Magneto4 click.

Note
Set start encoder position to zero position and first read of magnetic field strength.

◆ magneto4_generic_transfer()

void magneto4_generic_transfer ( magneto4_t * ctx,
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

◆ magneto4_get_encoder_direction()

uint8_t magneto4_get_encoder_direction ( magneto4_t * ctx)

Encoder direction.

Parameters
ctxClick object.
Returns
direction
- 0 : no movement;
- 1 : right to left direction;
- 2 : left to right direction;

@description This function gives you information on the direction of the magnet movement.

◆ magneto4_get_encoder_position()

void magneto4_get_encoder_position ( magneto4_t * ctx)

Encoder position.

Parameters
ctxClick object.
Returns
32-bit signed magnetics linear position of the sensor

@description This function get encoder position.

◆ magneto4_get_index()

uint8_t magneto4_get_index ( magneto4_t * ctx)

Get IND ( interrupt ) pin status.

Parameters
ctxClick object.
Returns
IND pin state:
  - 0 : low;
  - 1 : high;
*

@description Functions for get IND ( interrupt ) pin status.

◆ magneto4_get_magnetic_field()

uint16_t magneto4_get_magnetic_field ( magneto4_t * ctx)

Measurement Field.

Parameters
ctxClick object.
Returns
12-bit data ( magnetic field strength ).

@description This function measure magnetic field strength. Use this function to detect the presence of a magnet.

◆ magneto4_get_magnetic_status()

uint8_t magneto4_get_magnetic_status ( magneto4_t * ctx,
mag_status_t * mag_status )

Get Magnetic measurement status.

Parameters
ctxClick object.
mag_statusStructure that contains status information.
Returns
8-bit magnetic status data.

@description This function gets magnetic measurement status data.

◆ magneto4_get_out_a()

uint8_t magneto4_get_out_a ( magneto4_t * ctx)

Get A ( AN ) pin status.

Parameters
ctxClick object.
Returns
A pin state:
  - 0 : low;
  - 1 : high;
*

@description Functions for get A ( AN ) pin status.

◆ magneto4_get_out_b()

uint8_t magneto4_get_out_b ( magneto4_t * ctx)

Get B ( RST ) pin status.

Parameters
ctxClick object.
Returns
B pin state:
  - 0 : low;
  - 1 : high;
*

@description Functions for get B ( RST ) pin status.

◆ magneto4_init()

MAGNETO4_RETVAL magneto4_init ( magneto4_t * ctx,
magneto4_cfg_t * cfg )

Initialization function.

Parameters
magneto4Click object.
cfgClick configuration structure.

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

◆ magneto4_set_start_position()

void magneto4_set_start_position ( magneto4_t * ctx,
int32_t encoder_pos )

Set start encoder position.

Parameters
ctxClick object.
encoder_posStart encoder position.

@description Use this function to set the start position of the encoder. If this function is not called - the start position encoder will be 0.

◆ magneto4_start_measurement()

uint32_t magneto4_start_measurement ( magneto4_t * ctx)

Measurement function.

Parameters
ctxClick object.
Returns
24-bit read data form SPI.

@description This function reading 24-bit data from the SPI.