Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for L3GD20 3-axis gyroscope from ST using SPI. More...
#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/spi.h"
#include "peripherals/l3gd20.h"
Go to the source code of this file.
Data Structures | |
struct | L3gd20_Spi |
union | L3gd20_Spi.data_rates |
Functions | |
void | l3gd20_spi_init (struct L3gd20_Spi *l3g, struct spi_periph *spi_p, uint8_t slave_idx) |
void | l3gd20_spi_start_configure (struct L3gd20_Spi *l3g) |
void | l3gd20_spi_read (struct L3gd20_Spi *l3g) |
void | l3gd20_spi_event (struct L3gd20_Spi *l3g) |
static void | l3gd20_spi_periodic (struct L3gd20_Spi *l3g) |
convenience function: read or start configuration if not already initialized More... | |
Driver for L3GD20 3-axis gyroscope from ST using SPI.
Definition in file l3gd20_spi.h.
struct L3gd20_Spi |
Definition at line 38 of file l3gd20_spi.h.
Data Fields | ||
---|---|---|
struct L3gd20Config | config | |
volatile bool | data_available | data ready flag |
union L3gd20_Spi | data_rates | |
enum L3gd20ConfStatus | init_status | init status |
bool | initialized | config done flag |
volatile uint8_t | rx_buf[8] | |
struct spi_periph * | spi_p | |
struct spi_transaction | spi_trans | |
volatile uint8_t | tx_buf[2] |
union L3gd20_Spi.data_rates |
Definition at line 46 of file l3gd20_spi.h.
Data Fields | ||
---|---|---|
struct Int16Rates | rates | data vector in accel coordinate system |
int16_t | value[3] | data values accessible by channel index |
void l3gd20_spi_event | ( | struct L3gd20_Spi * | l3g | ) |
Definition at line 135 of file l3gd20_spi.c.
References L3gd20_Spi::data_available, L3gd20_Spi::data_rates, L3gd20_Spi::init_status, L3gd20_Spi::initialized, Int16FromBuf, L3G_CONF_UNINIT, L3G_CONF_WHO_AM_I, L3G_CONF_WHO_AM_I_OK, l3gd20_spi_send_config(), L3GD20_WHO_AM_I, L3gd20_Spi::rx_buf, L3gd20_Spi::spi_trans, SPITransDone, SPITransFailed, SPITransSuccess, and spi_transaction::status.
Referenced by imu_px4_event().
void l3gd20_spi_init | ( | struct L3gd20_Spi * | l3g, |
struct spi_periph * | spi_p, | ||
uint8_t | slave_idx | ||
) |
Definition at line 30 of file l3gd20_spi.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, L3gd20_Spi::config, spi_transaction::cpha, spi_transaction::cpol, L3gd20_Spi::data_available, spi_transaction::dss, L3gd20_Spi::init_status, L3gd20_Spi::initialized, spi_transaction::input_buf, spi_transaction::input_length, L3G_CONF_UNINIT, l3gd20_set_default_config(), spi_transaction::output_buf, spi_transaction::output_length, L3gd20_Spi::rx_buf, spi_transaction::select, spi_transaction::slave_idx, L3gd20_Spi::spi_p, L3gd20_Spi::spi_trans, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, and L3gd20_Spi::tx_buf.
Referenced by imu_px4_init().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 60 of file l3gd20_spi.h.
References L3gd20_Spi::initialized, l3gd20_spi_read(), and l3gd20_spi_start_configure().
Referenced by imu_px4_periodic().
void l3gd20_spi_read | ( | struct L3gd20_Spi * | l3g | ) |
Definition at line 122 of file l3gd20_spi.c.
References L3gd20_Spi::initialized, spi_transaction::input_length, L3GD20_REG_STATUS_REG, spi_transaction::output_length, L3gd20_Spi::spi_p, spi_submit(), L3gd20_Spi::spi_trans, SPITransDone, spi_transaction::status, and L3gd20_Spi::tx_buf.
Referenced by l3gd20_spi_periodic().
void l3gd20_spi_start_configure | ( | struct L3gd20_Spi * | l3g | ) |
Definition at line 112 of file l3gd20_spi.c.
References L3gd20_Spi::init_status, L3G_CONF_UNINIT, l3gd20_spi_send_config(), L3gd20_Spi::spi_trans, SPITransDone, SPITransSuccess, and spi_transaction::status.
Referenced by l3gd20_spi_periodic().