thunder  2.0.0.0
Functions
Public function

Functions

void thunder_cfg_setup (thunder_cfg_t *cfg)
 Config Object Initialization function. More...
 
THUNDER_RETVAL thunder_init (thunder_t *ctx, thunder_cfg_t *cfg)
 Initialization function. More...
 
void thunder_default_cfg (thunder_t *ctx)
 Click Default Configuration function. More...
 
void thunder_generic_transfer (thunder_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function. More...
 
uint8_t thunder_write_reg (thunder_t *ctx, uint8_t reg_addr, uint8_t transfer_data)
 Generic Write function. More...
 
uint8_t thunder_read_reg (thunder_t *ctx, uint8_t reg_addr, uint8_t *data_out, uint8_t n_bytes)
 Generic Read function. More...
 
void thunder_send_command (thunder_t *ctx, uint8_t command)
 Command Send function. More...
 
uint8_t thunder_check_interr (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.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ thunder_check_interr()

uint8_t thunder_check_interr ( thunder_t ctx)

Interrupt Check function.

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

@description 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.

@description 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.

@description This function executes default configuration for Thunder click.

◆ thunder_generic_transfer()

void thunder_generic_transfer ( thunder_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

◆ 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

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

◆ thunder_init()

THUNDER_RETVAL thunder_init ( thunder_t ctx,
thunder_cfg_t cfg 
)

Initialization function.

Parameters
thunderClick object.
cfgClick configuration structure.

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

◆ thunder_read_reg()

uint8_t thunder_read_reg ( thunder_t ctx,
uint8_t  reg_addr,
uint8_t *  data_out,
uint8_t  n_bytes 
)

Generic Read function.

Parameters
ctxClick object.
reg_addrAddress which from data be read.
data_utBuffer where data be stored.
n_bytesNumber of bytes to be read.
Returns
0 - OK, 1 - Wrong address parameter, 2 - Too large number of bytes parameter (MAX 51 bytes)

@description Function reads the desired number of bytes from the registers.

◆ thunder_send_command()

void thunder_send_command ( thunder_t ctx,
uint8_t  command 
)

Command Send function.

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

@description Function performs the one of two possible commands.

◆ thunder_write_reg()

uint8_t thunder_write_reg ( thunder_t ctx,
uint8_t  reg_addr,
uint8_t  transfer_data 
)

Generic Write function.

Parameters
ctxClick object.
reg_addrAddress where data be written.
transfer_dataData to be written.
Returns
0 - OK, 1 - Wrong address parameter

@description Function writes one byte to the register.