thunder 2.0.0.0
thunder.h File Reference

This file contains API for Thunder Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  thunder_t
 Click ctx object definition. More...
 
struct  thunder_cfg_t
 Click configuration structure definition. More...
 

Macros

#define THUNDER_MAP_MIKROBUS(cfg, mikrobus)
 
#define THUNDER_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define THUNDER_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define THUNDER_OK   0x00
 
#define THUNDER_ERROR   0xFF
 
#define THUNDER_DEV_ADDR_0   0x00
 
#define THUNDER_DEV_ADDR_1   0x01
 
#define THUNDER_DEV_ADDR_2   0x02
 
#define THUNDER_DEV_ADDR_3   0x03
 
#define THUNDER_REG_CONFIG_0   0x00
 
#define THUNDER_REG_CONFIG_1   0x01
 
#define THUNDER_REG_CONFIG_2   0x02
 
#define THUNDER_REG_CONFIG_3_INTERR   0x03
 
#define THUNDER_REG_ENERGY_LIGHTNING_LSBYTE   0x04
 
#define THUNDER_REG_ENERGY_LIGHTNING_MSBYTE   0x05
 
#define THUNDER_REG_ENERGY_LIGHTNING_MMSBYTE   0x06
 
#define THUNDER_REG_DISTANCE   0x07
 
#define THUNDER_REG_INTERR_PIN_CONFIG   0x08
 
#define THUNDER_REG_LDLUT_1   0x09
 
#define THUNDER_REG_LDLUT_2   0x0A
 
#define THUNDER_REG_LDLUT_3   0x0B
 
#define THUNDER_REG_LDLUT_4   0x0C
 
#define THUNDER_REG_LDLUT_5   0x0D
 
#define THUNDER_REG_LDLUT_6   0x0E
 
#define THUNDER_REG_LDLUT_7   0x0F
 
#define THUNDER_REG_LDLUT_8   0x10
 
#define THUNDER_REG_LDLUT_9   0x11
 
#define THUNDER_REG_LDLUT_10   0x12
 
#define THUNDER_REG_LDLUT_11   0x13
 
#define THUNDER_REG_LDLUT_12   0x14
 
#define THUNDER_REG_LDLUT_13   0x15
 
#define THUNDER_REG_LDLUT_14   0x16
 
#define THUNDER_REG_LDLUT_15   0x17
 
#define THUNDER_REG_LDLUT_16   0x18
 
#define THUNDER_REG_LDLUT_17   0x19
 
#define THUNDER_REG_LDLUT_18   0x1A
 
#define THUNDER_REG_LDLUT_19   0x1B
 
#define THUNDER_REG_LDLUT_20   0x1C
 
#define THUNDER_REG_LDLUT_21   0x1D
 
#define THUNDER_REG_LDLUT_22   0x1E
 
#define THUNDER_REG_LDLUT_23   0x1F
 
#define THUNDER_REG_LDLUT_24   0x20
 
#define THUNDER_REG_LDLUT_25   0x21
 
#define THUNDER_REG_LDLUT_26   0x22
 
#define THUNDER_REG_LDLUT_27   0x23
 
#define THUNDER_REG_LDLUT_28   0x24
 
#define THUNDER_REG_LDLUT_29   0x25
 
#define THUNDER_REG_LDLUT_30   0x26
 
#define THUNDER_REG_LDLUT_31   0x27
 
#define THUNDER_REG_LDLUT_32   0x28
 
#define THUNDER_REG_LDLUT_33   0x29
 
#define THUNDER_REG_LDLUT_34   0x2A
 
#define THUNDER_REG_LDLUT_35   0x2B
 
#define THUNDER_REG_LDLUT_36   0x2C
 
#define THUNDER_REG_LDLUT_37   0x2D
 
#define THUNDER_REG_LDLUT_38   0x2E
 
#define THUNDER_REG_LDLUT_39   0x2F
 
#define THUNDER_REG_LDLUT_40   0x30
 
#define THUNDER_REG_LDLUT_41   0x31
 
#define THUNDER_REG_LDLUT_42   0x32
 
#define THUNDER_REG_RESET   0x3C
 
#define THUNDER_REG_CALIB   0x3D
 
#define THUNDER_INDOOR   0x24
 
#define THUNDER_OUTDOOR   0x1C
 
#define THUNDER_NORMAL_MODE   0x00
 
#define THUNDER_POWER_DOWN   0x01
 
#define THUNDER_DEFAULT_NOISE_FLOOR_LVL   0x20
 
#define THUNDER_DEFAULT_WDG_THRESHOLD   0x02
 
#define THUNDER_CLEAR_STAT   0xC0
 
#define THUNDER_1_LIGHTNING   0x80
 
#define THUNDER_5_LIGHTNINGS   0x90
 
#define THUNDER_9_LIGHTNINGS   0xA0
 
#define THUNDER_16_LIGHTNINGS   0xB0
 
#define THUNDER_DEFAULT_SREJ   0x82
 
#define THUNDER_DIV_RATIO_16   0x00
 
#define THUNDER_DIV_RATIO_32   0x40
 
#define THUNDER_DIV_RATIO_64   0x80
 
#define THUNDER_DIV_RATIO_128   0xC0
 
#define THUNDER_MASK_DISTURBER   0x20
 
#define THUNDER_UNMASK_DISTURBER   0x00
 
#define THUNDER_NO_INTERR   0x00
 
#define THUNDER_NOISE_LEVEL_INTERR   0x01
 
#define THUNDER_DISTURBER_INTERR   0x04
 
#define THUNDER_LIGHTNING_INTERR   0x08
 
#define THUNDER_LCO_ON_IRQ_PIN   0x80
 
#define THUNDER_SRCO_ON_IRQ_PIN   0x40
 
#define THUNDER_TRCO_ON_IRQ_PIN   0x20
 
#define THUNDER_NO_DISPLAY_ON_IRQ_PIN   0x00
 
#define THUNDER_DEFAULT_TUNE_CAP   0x00
 
#define THUNDER_RESET_COMM   0x00
 
#define THUNDER_CALIB_RCO_COMM   0x01
 

Functions

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

Detailed Description

This file contains API for Thunder Click driver.