41static void (*a_callback)(float (*dps)[3], uint16_t len) = NULL;
42static int16_t gs_raw[32][3];
43static float gs_data[32][3];
69static void a_l3gd20h_interface_receive_callback(uint8_t type)
79 res =
l3gd20h_read(&gs_handle, (int16_t (*)[3])(gs_raw), (
float (*)[3])(gs_data), (uint16_t *)&len);
82 if (a_callback != NULL)
84 a_callback(gs_data, len);
102 res =
l3gd20h_read(&gs_handle, (int16_t (*)[3])(gs_raw), (
float (*)[3])(gs_data), (uint16_t *)&len);
147 void (*callback)(
float (*dps)[3], uint16_t len))
533 (uint16_t *)&threshold);
672 a_callback = callback;
driver l3gd20h fifo header file
uint8_t l3gd20h_set_high_pass_filter(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable high pass filter
uint8_t l3gd20h_set_data_format(l3gd20h_handle_t *handle, l3gd20h_data_format_t data_format)
set the data format
uint8_t l3gd20h_set_block_data_update(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the block data update
uint8_t l3gd20h_set_mode(l3gd20h_handle_t *handle, l3gd20h_mode_t mode)
set the chip mode
uint8_t l3gd20h_set_high_pass_filter_mode(l3gd20h_handle_t *handle, l3gd20h_high_pass_filter_mode_t mode)
set the high pass filter mode
uint8_t l3gd20h_set_rate_bandwidth(l3gd20h_handle_t *handle, l3gd20h_lodr_odr_bw_t rate_bandwidth)
set the rate bandwidth
uint8_t l3gd20h_set_level_sensitive_latched(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the level sensitive latched
uint8_t l3gd20h_read(l3gd20h_handle_t *handle, int16_t(*raw)[3], float(*dps)[3], uint16_t *len)
read the data
uint8_t l3gd20h_set_out_selection(l3gd20h_handle_t *handle, l3gd20h_selection_t selection)
set the out selection
uint8_t l3gd20h_set_boot(l3gd20h_handle_t *handle, l3gd20h_boot_t boot)
set the boot
uint8_t l3gd20h_set_addr_pin(l3gd20h_handle_t *handle, l3gd20h_address_t addr_pin)
set the iic address pin
l3gd20h_address_t
l3gd20h address enumeration definition
uint8_t l3gd20h_set_interface(l3gd20h_handle_t *handle, l3gd20h_interface_t interface)
set the chip interface
uint8_t l3gd20h_set_high_pass_filter_reference(l3gd20h_handle_t *handle, uint8_t value)
set the high pass filter reference
uint8_t l3gd20h_deinit(l3gd20h_handle_t *handle)
close the chip
uint8_t l3gd20h_set_edge_trigger(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the edge trigger
l3gd20h_interface_t
l3gd20h interface enumeration definition
uint8_t l3gd20h_set_full_scale(l3gd20h_handle_t *handle, l3gd20h_full_scale_t full_scale)
set the full scale
uint8_t l3gd20h_irq_handler(l3gd20h_handle_t *handle, uint8_t num)
interrupt handler
uint8_t l3gd20h_init(l3gd20h_handle_t *handle)
initialize the chip
uint8_t l3gd20h_set_level_trigger(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the level trigger
uint8_t l3gd20h_set_self_test(l3gd20h_handle_t *handle, l3gd20h_self_test_t self_test)
set the self test
uint8_t l3gd20h_set_high_pass_filter_cut_off_frequency(l3gd20h_handle_t *handle, l3gd20h_high_pass_filter_cut_off_frequency_t frequency)
set the high pass filter cut off frequency
uint8_t l3gd20h_set_axis(l3gd20h_handle_t *handle, l3gd20h_axis_t axis, l3gd20h_bool_t enable)
set the axis
struct l3gd20h_handle_s l3gd20h_handle_t
l3gd20h handle structure definition
#define L3GD20H_FIFO_DEFAULT_DATA_FORMAT
#define L3GD20H_FIFO_DEFAULT_SELF_TEST
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_ACTIVE_LEVEL
#define L3GD20H_FIFO_DEFAULT_BLOCK_DATA_UPDATE
#define L3GD20H_FIFO_DEFAULT_AXIS_Z
uint8_t l3gd20h_fifo_irq_handler(void)
fifo example irq callback
#define L3GD20H_FIFO_DEFAULT_EDGE_TRIGGER
#define L3GD20H_FIFO_DEFAULT_HIGH_PASS_FILTER_REFERENCE
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_PIN_TYPE
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_LATCH
#define L3GD20H_FIFO_DEFAULT_BOOT_ON_INTERRUPT1
#define L3GD20H_FIFO_DEFAULT_AXIS_Y
#define L3GD20H_FIFO_DEFAULT_INTERRUPT1
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_Y_LOW_EVENT
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_Y_HIGH_EVENT
#define L3GD20H_FIFO_DEFAULT_FIFO_EMPTY_ON_INTERRUPT2
#define L3GD20H_FIFO_DEFAULT_HIGH_PASS_FILTER
#define L3GD20H_FIFO_DEFAULT_RATE_BANDWIDTH
#define L3GD20H_FIFO_DEFAULT_DATA_READY_ON_INTERRUPT2
#define L3GD20H_FIFO_DEFAULT_COUNTER_MODE
uint8_t l3gd20h_fifo_deinit(void)
fifo example deinit
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_X_LOW_EVENT
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_X_HIGH_EVENT
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_Z_HIGH_EVENT
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_Z_LOW_EVENT
#define L3GD20H_FIFO_DEFAULT_LEVEL_TRIGGER
#define L3GD20H_FIFO_DEFAULT_WAIT
#define L3GD20H_FIFO_DEFAULT_FIFO_THRESHOLD
#define L3GD20H_FIFO_DEFAULT_FULL_SCALE
#define L3GD20H_FIFO_DEFAULT_DATA_READY_ACTIVE_LEVEL
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_AND_OR_COMBINATION
#define L3GD20H_FIFO_DEFAULT_STOP_ON_FIFO_THRESHOLD
#define L3GD20H_FIFO_DEFAULT_LEVEL_SENSITIVE_LATCHED
#define L3GD20H_FIFO_DEFAULT_OUT_SELECTION
#define L3GD20H_FIFO_DEFAULT_HIGH_PASS_FILTER_MODE
#define L3GD20H_FIFO_DEFAULT_DURATION
uint8_t l3gd20h_fifo_init(l3gd20h_interface_t interface, l3gd20h_address_t addr_pin, void(*callback)(float(*dps)[3], uint16_t len))
fifo example init
#define L3GD20H_FIFO_DEFAULT_BOOT
l3gd20h fifo example default definition
#define L3GD20H_FIFO_DEFAULT_AXIS_X
#define L3GD20H_FIFO_DEFAULT_HIGH_PASS_FILTER_CUT_OFF
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_THRESHOLD
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_SELECTION
uint8_t l3gd20h_set_stop_on_fifo_threshold(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable stop on fifo threshold
uint8_t l3gd20h_set_fifo_mode(l3gd20h_handle_t *handle, l3gd20h_fifo_mode_t fifo_mode)
set the fifo mode
uint8_t l3gd20h_set_fifo(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the fifo
uint8_t l3gd20h_set_fifo_threshold(l3gd20h_handle_t *handle, uint8_t threshold)
set the fifo threshold
void l3gd20h_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t l3gd20h_interface_iic_deinit(void)
interface iic bus deinit
uint8_t l3gd20h_interface_spi_read(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus read
uint8_t l3gd20h_interface_iic_init(void)
interface iic bus init
uint8_t l3gd20h_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
uint8_t l3gd20h_interface_spi_init(void)
interface spi bus init
uint8_t l3gd20h_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
uint8_t l3gd20h_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
uint8_t l3gd20h_interface_spi_deinit(void)
interface spi bus deinit
void l3gd20h_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t l3gd20h_set_interrupt_pin_type(l3gd20h_handle_t *handle, l3gd20h_pin_type_t pin_type)
set the interrupt pin type
uint8_t l3gd20h_set_data_ready_on_interrupt2(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the data ready on interrupt2
uint8_t l3gd20h_set_boot_on_interrupt1(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable boot on the interrupt1
uint8_t l3gd20h_set_x_interrupt_threshold(l3gd20h_handle_t *handle, uint16_t threshold)
set the x interrupt threshold
uint8_t l3gd20h_set_wait(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the wait
uint8_t l3gd20h_set_interrupt_event(l3gd20h_handle_t *handle, l3gd20h_interrupt_event_t interrupt_event, l3gd20h_bool_t enable)
set the interrupt event
uint8_t l3gd20h_set_duration(l3gd20h_handle_t *handle, uint8_t duration)
set the wait duration
uint8_t l3gd20h_set_fifo_threshold_on_interrupt2(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the fifo threshold on interrupt2
uint8_t l3gd20h_set_data_ready_active_level(l3gd20h_handle_t *handle, l3gd20h_interrupt_active_level_t level)
set the data ready active level
uint8_t l3gd20h_set_counter_mode(l3gd20h_handle_t *handle, l3gd20h_counter_mode_t counter_mode)
set the counter mode
uint8_t l3gd20h_set_interrupt_active_level(l3gd20h_handle_t *handle, l3gd20h_interrupt_active_level_t level)
set the interrupt active level
uint8_t l3gd20h_set_fifo_overrun_on_interrupt2(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the fifo overrun on interrupt2
uint8_t l3gd20h_interrupt_threshold_convert_to_register(l3gd20h_handle_t *handle, float dps, uint16_t *reg)
convert the interrupt threshold real data to the register raw data
uint8_t l3gd20h_set_interrupt_selection(l3gd20h_handle_t *handle, l3gd20h_selection_t selection)
set the interrupt selection
uint8_t l3gd20h_set_fifo_empty_on_interrupt2(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the fifo empty on interrupt2
uint8_t l3gd20h_set_z_interrupt_threshold(l3gd20h_handle_t *handle, uint16_t threshold)
set the z interrupt threshold
uint8_t l3gd20h_set_interrupt1(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the interrupt1
uint8_t l3gd20h_set_y_interrupt_threshold(l3gd20h_handle_t *handle, uint16_t threshold)
set the y interrupt threshold
@ L3GD20H_INTERRUPT_EVENT_Z_LOW_EVENT
@ L3GD20H_INTERRUPT_EVENT_Y_HIGH_EVENT
@ L3GD20H_INTERRUPT_EVENT_Y_LOW_EVENT
@ L3GD20H_INTERRUPT_EVENT_AND_OR_COMBINATION
@ L3GD20H_INTERRUPT_EVENT_LATCH
@ L3GD20H_INTERRUPT_EVENT_X_LOW_EVENT
@ L3GD20H_INTERRUPT_EVENT_Z_HIGH_EVENT
@ L3GD20H_INTERRUPT_EVENT_X_HIGH_EVENT
@ L3GD20H_INTERRUPT2_FIFO_EMPTY
@ L3GD20H_INTERRUPT2_FIFO_THRESHOLD
@ L3GD20H_INTERRUPT2_FIFO_OVERRRUN
#define DRIVER_L3GD20H_LINK_IIC_DEINIT(HANDLE, FUC)
link iic_deinit function
#define DRIVER_L3GD20H_LINK_IIC_INIT(HANDLE, FUC)
link iic_init function
#define DRIVER_L3GD20H_LINK_SPI_INIT(HANDLE, FUC)
link spi_init function
#define DRIVER_L3GD20H_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
#define DRIVER_L3GD20H_LINK_SPI_WRITE(HANDLE, FUC)
link spi_write function
#define DRIVER_L3GD20H_LINK_IIC_READ(HANDLE, FUC)
link iic_read function
#define DRIVER_L3GD20H_LINK_INIT(HANDLE, STRUCTURE)
initialize l3gd20h_handle_t structure
#define DRIVER_L3GD20H_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
link receive_callback function
#define DRIVER_L3GD20H_LINK_SPI_READ(HANDLE, FUC)
link spi_read function
#define DRIVER_L3GD20H_LINK_SPI_DEINIT(HANDLE, FUC)
link spi_deinit function
#define DRIVER_L3GD20H_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
#define DRIVER_L3GD20H_LINK_IIC_WRITE(HANDLE, FUC)
link iic_write function