LibDriver AS3935
Loading...
Searching...
No Matches
driver_as3935.h File Reference

driver as3935 header file More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for driver_as3935.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  as3935_handle_s
 as3935 handle structure definition More...
struct  as3935_info_s
 as3935 information structure definition More...

Macros

#define DRIVER_AS3935_LINK_INIT(HANDLE, STRUCTURE)
 initialize as3935_handle_t structure
#define DRIVER_AS3935_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_AS3935_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_AS3935_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_AS3935_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_AS3935_LINK_SPI_INIT(HANDLE, FUC)
 link spi_init function
#define DRIVER_AS3935_LINK_SPI_DEINIT(HANDLE, FUC)
 link spi_deinit function
#define DRIVER_AS3935_LINK_SPI_READ(HANDLE, FUC)
 link spi_read function
#define DRIVER_AS3935_LINK_SPI_WRITE(HANDLE, FUC)
 link spi_write function
#define DRIVER_AS3935_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_AS3935_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function
#define DRIVER_AS3935_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
 link receive_callback function

Typedefs

typedef struct as3935_handle_s as3935_handle_t
 as3935 handle structure definition
typedef struct as3935_info_s as3935_info_t
 as3935 information structure definition

Enumerations

enum  as3935_interface_t { AS3935_INTERFACE_IIC = 0x00 , AS3935_INTERFACE_SPI = 0x01 }
 as3935 interface enumeration definition More...
enum  as3935_address_t { AS3935_ADDRESS_1 = 0x02 , AS3935_ADDRESS_2 = 0x04 , AS3935_ADDRESS_3 = 0x06 }
 as3935 address enumeration definition More...
enum  as3935_bool_t { AS3935_BOOL_FALSE = 0x00 , AS3935_BOOL_TRUE = 0x01 }
 as3935 bool enumeration definition More...
enum  as3935_afe_gain_t { AS3935_AFE_GAIN_INDOOR = 0x12 , AS3935_AFE_GAIN_OUTDOOR = 0x0E }
 as3935 afe gain enumeration definition More...
enum  as3935_noise_floor_level_t {
  AS3935_NOISE_FLOOR_LEVEL_OUTDOOR_390_INDOOR_28 = 0x0 , AS3935_NOISE_FLOOR_LEVEL_OUTDOOR_630_INDOOR_45 = 0x1 , AS3935_NOISE_FLOOR_LEVEL_OUTDOOR_860_INDOOR_62 = 0x2 , AS3935_NOISE_FLOOR_LEVEL_OUTDOOR_1100_INDOOR_78 = 0x3 ,
  AS3935_NOISE_FLOOR_LEVEL_OUTDOOR_1140_INDOOR_95 = 0x4 , AS3935_NOISE_FLOOR_LEVEL_OUTDOOR_1570_INDOOR_112 = 0x5 , AS3935_NOISE_FLOOR_LEVEL_OUTDOOR_1800_INDOOR_130 = 0x6 , AS3935_NOISE_FLOOR_LEVEL_OUTDOOR_2000_INDOOR_146 = 0x7
}
 as3935 noise floor level enumeration definition More...
enum  as3935_lightning_min_number_t { AS3935_LIGHTNING_MIN_NUMBER_1 = 0x0 , AS3935_LIGHTNING_MIN_NUMBER_5 = 0x1 , AS3935_LIGHTNING_MIN_NUMBER_9 = 0x2 , AS3935_LIGHTNING_MIN_NUMBER_16 = 0x3 }
 as3935 lightning min number enumeration definition More...
enum  as3935_frequency_division_ration_t { AS3935_FREQUENCY_DIVISION_RATION_16 = 0x0 , AS3935_FREQUENCY_DIVISION_RATION_32 = 0x1 , AS3935_FREQUENCY_DIVISION_RATION_64 = 0x2 , AS3935_FREQUENCY_DIVISION_RATION_128 = 0x3 }
 as3935 frequency division ration enumeration definition More...
enum  as3935_interrupt_status_t { AS3935_INTERRUPT_STATUS_NOISE_LEVEL_TOO_HIGH = 0x01 , AS3935_INTERRUPT_STATUS_DISTURBER_DETECTED = 0x04 , AS3935_INTERRUPT_STATUS_LIGHTNING_INTERRUPT = 0x08 }
 as3935 interrupt status enumeration definition More...

Functions

uint8_t as3935_info (as3935_info_t *info)
 get chip's information
uint8_t as3935_set_interface (as3935_handle_t *handle, as3935_interface_t interface)
 set the chip interface
uint8_t as3935_get_interface (as3935_handle_t *handle, as3935_interface_t *interface)
 get the chip interface
uint8_t as3935_set_addr_pin (as3935_handle_t *handle, as3935_address_t addr_pin)
 set the iic address pin
uint8_t as3935_get_addr_pin (as3935_handle_t *handle, as3935_address_t *addr_pin)
 get the iic address pin
uint8_t as3935_irq_handler (as3935_handle_t *handle)
 irq handler
uint8_t as3935_init (as3935_handle_t *handle)
 initialize the chip
uint8_t as3935_deinit (as3935_handle_t *handle)
 close the chip
uint8_t as3935_read_single_lightning_energy (as3935_handle_t *handle, uint32_t *energy)
 read single lightning energy
uint8_t as3935_read_distance (as3935_handle_t *handle, uint8_t *raw, int8_t *km)
 read distance
uint8_t as3935_set_power_down (as3935_handle_t *handle, as3935_bool_t enable)
 set power down
uint8_t as3935_get_power_down (as3935_handle_t *handle, as3935_bool_t *enable)
 get power down
uint8_t as3935_set_afe_gain_boost (as3935_handle_t *handle, as3935_afe_gain_t gain)
 set afe gain boost
uint8_t as3935_get_afe_gain_boost (as3935_handle_t *handle, as3935_afe_gain_t *gain)
 get afe gain boost
uint8_t as3935_set_noise_floor_level (as3935_handle_t *handle, as3935_noise_floor_level_t level)
 set noise floor level
uint8_t as3935_get_noise_floor_level (as3935_handle_t *handle, as3935_noise_floor_level_t *level)
 get noise floor level
uint8_t as3935_set_watchdog_threshold (as3935_handle_t *handle, uint8_t threshold)
 set watchdog threshold
uint8_t as3935_get_watchdog_threshold (as3935_handle_t *handle, uint8_t *threshold)
 get watchdog threshold
uint8_t as3935_set_clear_statistics (as3935_handle_t *handle, as3935_bool_t enable)
 enable or disable clear statistics
uint8_t as3935_get_clear_statistics (as3935_handle_t *handle, as3935_bool_t *enable)
 get clear statistics status
uint8_t as3935_set_lightning_min_number (as3935_handle_t *handle, as3935_lightning_min_number_t number)
 set lightning min number
uint8_t as3935_get_lightning_min_number (as3935_handle_t *handle, as3935_lightning_min_number_t *number)
 get lightning min number
uint8_t as3935_set_spike_rejection (as3935_handle_t *handle, uint8_t rejection)
 set spike rejection
uint8_t as3935_get_spike_rejection (as3935_handle_t *handle, uint8_t *rejection)
 get spike rejection
uint8_t as3935_set_frequency_division_ration (as3935_handle_t *handle, as3935_frequency_division_ration_t division)
 set frequency division ration
uint8_t as3935_get_frequency_division_ration (as3935_handle_t *handle, as3935_frequency_division_ration_t *division)
 get frequency division ration
uint8_t as3935_set_mask_disturber (as3935_handle_t *handle, as3935_bool_t enable)
 enable or disable mask disturber
uint8_t as3935_get_mask_disturber (as3935_handle_t *handle, as3935_bool_t *enable)
 get mask disturber status
uint8_t as3935_get_interrupt_status (as3935_handle_t *handle, as3935_interrupt_status_t *status)
 get interrupt status
uint8_t as3935_set_lc_osc_display_on_irq (as3935_handle_t *handle, as3935_bool_t enable)
 enable or disable lc osc display on irq
uint8_t as3935_get_display_lc_osc_on_irq (as3935_handle_t *handle, as3935_bool_t *enable)
 get lc osc display on irq status
uint8_t as3935_set_system_rc_osc_display_on_irq (as3935_handle_t *handle, as3935_bool_t enable)
 enable or disable system rc osc display on irq
uint8_t as3935_get_system_rc_osc_display_on_irq (as3935_handle_t *handle, as3935_bool_t *enable)
 get system rc osc display on irq status
uint8_t as3935_set_timer_rc_osc_display_on_irq (as3935_handle_t *handle, as3935_bool_t enable)
 enable or disable timer rc osc display on irq
uint8_t as3935_get_timer_rc_osc_display_on_irq (as3935_handle_t *handle, as3935_bool_t *enable)
 get timer rc osc display on irq status
uint8_t as3935_set_internal_tuning_capacitor (as3935_handle_t *handle, uint8_t cap)
 set internal tuning capacitor
uint8_t as3935_get_internal_tuning_capacitor (as3935_handle_t *handle, uint8_t *cap)
 get internal tuning capacitor
uint8_t as3935_get_timer_rc_osc_calibration_done (as3935_handle_t *handle, as3935_bool_t *enable)
 get timer rc osc calibration done status
uint8_t as3935_get_timer_rc_osc_calibration_not_ok (as3935_handle_t *handle, as3935_bool_t *enable)
 get timer rc osc calibration not ok status
uint8_t as3935_get_system_rc_osc_calibration_done (as3935_handle_t *handle, as3935_bool_t *enable)
 get system rc osc calibration done status
uint8_t as3935_get_system_rc_osc_calibration_not_ok (as3935_handle_t *handle, as3935_bool_t *enable)
 get system rc osc calibration not ok status
uint8_t as3935_reset_default (as3935_handle_t *handle)
 reset to default
uint8_t as3935_set_calibrate_rc_osc (as3935_handle_t *handle)
 calibrate rc osc
uint8_t as3935_internal_tuning_capacitor_convert_to_register (as3935_handle_t *handle, float pf, uint8_t *reg)
 convert the internal tuning capacitor to the register raw data
uint8_t as3935_internal_tuning_capacitor_convert_to_data (as3935_handle_t *handle, uint8_t reg, float *pf)
 convert the register raw data to the internal tuning capacitor
uint8_t as3935_set_reg (as3935_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t as3935_get_reg (as3935_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver as3935 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2025-12-23

history

Date Version Author Description
2025/12/23 1.0 Shifeng Li first upload

Definition in file driver_as3935.h.