earthquake  2.0.0.0
Functions

Functions

void earthquake_cfg_setup (earthquake_cfg_t *cfg)
 Config Object Initialization function. More...
 
EARTHQUAKE_RETVAL earthquake_init (earthquake_t *ctx, earthquake_cfg_t *cfg)
 Initialization function. More...
 
void earthquake_generic_write (earthquake_t *ctx, uint16_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function. More...
 
void earthquake_generic_read (earthquake_t *ctx, uint16_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function. More...
 
uint8_t earthquake_proc_notify (earthquake_t *ctx)
 Shutoff output function. More...
 
uint8_t earthquake_shutoff_output (earthquake_t *ctx)
 Shutoff output function. More...
 
uint8_t earthquake_read_status (earthquake_t *ctx)
 Read status function. More...
 
uint16_t earthquake_read_si (earthquake_t *ctx)
 Read SI function. More...
 
void earthquake_clear_memory (earthquake_t *ctx)
 Clear Memory function. More...
 

Detailed Description

Function Documentation

◆ earthquake_cfg_setup()

void earthquake_cfg_setup ( earthquake_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.

◆ earthquake_clear_memory()

void earthquake_clear_memory ( earthquake_t ctx)

Clear Memory function.

Parameters
ctxClick object.
Returns
combined values of SI_H and SI_L registers

@description This function clears earthquake data, self-diagnostic data, latest offset data and initial installation data.

◆ earthquake_generic_read()

void earthquake_generic_read ( earthquake_t ctx,
uint16_t  reg,
uint8_t *  data_buf,
uint8_t  len 
)

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf.
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ earthquake_generic_write()

void earthquake_generic_write ( earthquake_t ctx,
uint16_t  reg,
uint8_t *  data_buf,
uint8_t  len 
)

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ earthquake_init()

EARTHQUAKE_RETVAL earthquake_init ( earthquake_t ctx,
earthquake_cfg_t cfg 
)

Initialization function.

Parameters
earthquakeClick object.
cfgClick configuration structure.

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

◆ earthquake_proc_notify()

uint8_t earthquake_proc_notify ( earthquake_t ctx)

Shutoff output function.

Parameters
ctxClick object.
Returns
  • 0 : when idle;
  • 1 : when working;

@description This function reads state od INT2 pin. An open-drain output, goes active during earthquake calculations, offset acquisition, and self-diagnostic processing.

◆ earthquake_read_si()

uint16_t earthquake_read_si ( earthquake_t ctx)

Read SI function.

Parameters
ctxClick object.
Returns
combined values of SI_H and SI_L registers

@description This function reads and combines data from SI_H and SI_L registers.

◆ earthquake_read_status()

uint8_t earthquake_read_status ( earthquake_t ctx)

Read status function.

Parameters
ctxClick object.
Returns
value that represents status
  • 0 : Normal Mode standby
  • 1 : Normal Mode not in standby
  • 2 : Initial Installation Mode
  • 3 : Offset Acquisition Mode
  • 4 : Self-Diagnostic Mode

@description This function reads data from a STATE register.

◆ earthquake_shutoff_output()

uint8_t earthquake_shutoff_output ( earthquake_t ctx)

Shutoff output function.

Parameters
ctxClick object.
Returns
  • 0 : when idle;
  • 1 : when working;

@description This function reads state od INT1 pin. An open-drain output, goes active (ON) when the shutoff judgment condition and collapse detection condition are met.