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

driver as3935 source file More...

#include "driver_as3935.h"
Include dependency graph for driver_as3935.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "AMS AS3935"
 chip register definition
#define MANUFACTURER_NAME   "AMS"
#define SUPPLY_VOLTAGE_MIN   2.4f
#define SUPPLY_VOLTAGE_MAX   5.5f
#define MAX_CURRENT   0.35f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   1000
#define AS3935_REG_NUMBER_0   0x00
 chip register definition
#define AS3935_REG_NUMBER_1   0x01
#define AS3935_REG_NUMBER_2   0x02
#define AS3935_REG_NUMBER_3   0x03
#define AS3935_REG_NUMBER_4   0x04
#define AS3935_REG_NUMBER_5   0x05
#define AS3935_REG_NUMBER_6   0x06
#define AS3935_REG_NUMBER_7   0x07
#define AS3935_REG_NUMBER_8   0x08
#define AS3935_REG_NUMBER_A   0x3A
#define AS3935_REG_NUMBER_B   0x3B
#define AS3935_REG_PRESET_DEFAULT   0x3C
#define AS3935_REG_CALIB_RCO   0x3D

Functions

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_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_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_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_init (as3935_handle_t *handle)
 initialize the chip
uint8_t as3935_deinit (as3935_handle_t *handle)
 close the chip
uint8_t as3935_irq_handler (as3935_handle_t *handle)
 irq handler
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
uint8_t as3935_info (as3935_info_t *info)
 get chip's information

Detailed Description

driver as3935 source 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.c.

Macro Definition Documentation

◆ AS3935_REG_CALIB_RCO

#define AS3935_REG_CALIB_RCO   0x3D

calib rco register

Definition at line 66 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_0

#define AS3935_REG_NUMBER_0   0x00

chip register definition

number 0 register

Definition at line 54 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_1

#define AS3935_REG_NUMBER_1   0x01

number 1 register

Definition at line 55 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_2

#define AS3935_REG_NUMBER_2   0x02

number 2 register

Definition at line 56 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_3

#define AS3935_REG_NUMBER_3   0x03

number 3 register

Definition at line 57 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_4

#define AS3935_REG_NUMBER_4   0x04

number 4 register

Definition at line 58 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_5

#define AS3935_REG_NUMBER_5   0x05

number 5 register

Definition at line 59 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_6

#define AS3935_REG_NUMBER_6   0x06

number 6 register

Definition at line 60 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_7

#define AS3935_REG_NUMBER_7   0x07

number 7 register

Definition at line 61 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_8

#define AS3935_REG_NUMBER_8   0x08

number 8 register

Definition at line 62 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_A

#define AS3935_REG_NUMBER_A   0x3A

number a register

Definition at line 63 of file driver_as3935.c.

◆ AS3935_REG_NUMBER_B

#define AS3935_REG_NUMBER_B   0x3B

number b register

Definition at line 64 of file driver_as3935.c.

◆ AS3935_REG_PRESET_DEFAULT

#define AS3935_REG_PRESET_DEFAULT   0x3C

preset default register

Definition at line 65 of file driver_as3935.c.

◆ CHIP_NAME

#define CHIP_NAME   "AMS AS3935"

chip register definition

chip name

Definition at line 42 of file driver_as3935.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_as3935.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "AMS"

manufacturer name

Definition at line 43 of file driver_as3935.c.

◆ MAX_CURRENT

#define MAX_CURRENT   0.35f

chip max current

Definition at line 46 of file driver_as3935.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   5.5f

chip max supply voltage

Definition at line 45 of file driver_as3935.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   2.4f

chip min supply voltage

Definition at line 44 of file driver_as3935.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_as3935.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_as3935.c.