thunder  2.0.0.0
Functions
Public function

Functions

void thunder_cfg_setup (thunder_cfg_t *cfg)
 Config Object Initialization function. More...
 
err_t thunder_init (thunder_t *ctx, thunder_cfg_t *cfg)
 Initialization function. More...
 
void thunder_default_cfg (thunder_t *ctx)
 Click Default Configuration function. More...
 
err_t thunder_generic_write (thunder_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Generic write function. More...
 
err_t thunder_generic_read (thunder_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Generic read function. More...
 
err_t thunder_write_reg (thunder_t *ctx, uint8_t reg, uint8_t data_in)
 Write reg function. More...
 
err_t thunder_read_reg (thunder_t *ctx, uint8_t reg, uint8_t *data_out)
 Read reg function. More...
 
void thunder_send_command (thunder_t *ctx, uint8_t command)
 Command Send function. More...
 
uint8_t thunder_check_int (thunder_t *ctx)
 Interrupt Check function. More...
 
void thunder_get_storm_info (thunder_t *ctx, uint32_t *energy_out, uint8_t *distance_out)
 Storm Information Get function. More...
 
uint8_t thunder_check_irq_pin (thunder_t *ctx)
 IRQ Pin Check function. More...
 

Detailed Description

Function Documentation

◆ thunder_cfg_setup()

void thunder_cfg_setup ( thunder_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes Click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ thunder_check_int()

uint8_t thunder_check_int ( thunder_t ctx)

Interrupt Check function.

Parameters
ctxClick object.
Returns
0x00 - No interrupt, 0x01 - Noise level too high, 0x04 - Disturber detected, 0x08 - Lightning interrupt

Function checks and returns the interrupt value.

◆ thunder_check_irq_pin()

uint8_t thunder_check_irq_pin ( thunder_t ctx)

IRQ Pin Check function.

Parameters
ctxClick object.
Returns
Value of the IRQ pin (INT)

Function returns the value of the IRQ pin (INT).

◆ thunder_default_cfg()

void thunder_default_cfg ( thunder_t ctx)

Click Default Configuration function.

Parameters
ctxClick object.

This function executes default configuration for Thunder Click.

◆ thunder_generic_read()

err_t thunder_generic_read ( thunder_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Generic read function.

Parameters
ctxClick object.
regRegister address
data_outRead data buffer
lenNumber of byte in read data buffer
Returns
0 - OK, -1 - ERROR

Generic SPI read, for receiving packages

◆ thunder_generic_write()

err_t thunder_generic_write ( thunder_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

Generic write function.

Parameters
ctxClick object.
regRegister address
data_inWrite data buffer
lenNumber of byte in write data buffer
Returns
0 - OK, -1 - ERROR

Generic SPI write, for sending packages

◆ thunder_get_storm_info()

void thunder_get_storm_info ( thunder_t ctx,
uint32_t *  energy_out,
uint8_t *  distance_out 
)

Storm Information Get function.

Parameters
ctxClick object.
energy_outEnergy of the single lightning
distance_outDistance estimation for the head of the storm

Function gets energy of the single lightning and distance estimation for the head of the storm.

◆ thunder_init()

err_t thunder_init ( thunder_t ctx,
thunder_cfg_t cfg 
)

Initialization function.

Parameters
thunderClick object.
cfgClick configuration structure.
Returns
0 - OK, -1 - ERROR

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

◆ thunder_read_reg()

err_t thunder_read_reg ( thunder_t ctx,
uint8_t  reg,
uint8_t *  data_out 
)

Read reg function.

Parameters
ctxClick object.
regAddress which from data be read.
data_outBuffer where data be stored.
Returns
0 - OK, -1 - ERROR

Function reads a data byte from the registers.

◆ thunder_send_command()

void thunder_send_command ( thunder_t ctx,
uint8_t  command 
)

Command Send function.

Parameters
ctxClick object.
command0 - Reset command, Value different from 0 - RCO calibrate command

Function performs the one of two possible commands.

◆ thunder_write_reg()

err_t thunder_write_reg ( thunder_t ctx,
uint8_t  reg,
uint8_t  data_in 
)

Write reg function.

Parameters
ctxClick object.
regAddress where data be written.
data_inData to be written.
Returns
0 - OK, -1 - ERROR

Function writes one byte to the register.