133 #define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))
142 if (bit_is_set(l3g->
rx_buf[1], 3)) {
enum SPIClockPolarity cpol
clock polarity control
enum SPIClockPhase cpha
clock phase control
enum SPISlaveSelect select
slave selection behavior
SPICallback before_cb
NULL or function called before the transaction.
SPICallback after_cb
NULL or function called after the transaction.
enum SPIDataSizeSelect dss
data transfer word size
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
uint16_t input_length
number of data words to read
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
volatile uint8_t * input_buf
pointer to receive buffer for DMA
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
enum SPIBitOrder bitorder
MSB/LSB order.
uint16_t output_length
number of data words to write
enum SPITransactionStatus status
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
@ SPICpolIdleHigh
CPOL = 1.
@ SPISelectUnselect
slave is selected before transaction and unselected after
SPI peripheral structure.
enum L3gd20DRBW drbw
Data rate and bandwidth.
bool spi_3_wire
Set 3-wire SPI mode, if FALSE: 4-wire SPI mode.
enum L3gd20FullScale full_scale
gyro full scale
static void l3gd20_set_default_config(struct L3gd20Config *c)
#define L3GD20_REG_WHO_AM_I
#define L3GD20_WHO_AM_I
L3GD20 device identifier contained in L3GD20_REG_WHO_AM_I.
#define L3GD20_REG_CTRL_REG4
#define L3GD20_REG_CTRL_REG1
#define L3GD20_REG_STATUS_REG
static void l3gd20_spi_send_config(struct L3gd20_Spi *l3g)
void l3gd20_spi_event(struct L3gd20_Spi *l3g)
void l3gd20_spi_start_configure(struct L3gd20_Spi *l3g)
void l3gd20_spi_init(struct L3gd20_Spi *l3g, struct spi_periph *spi_p, uint8_t slave_idx)
void l3gd20_spi_read(struct L3gd20_Spi *l3g)
static void l3gd20_spi_write_to_reg(struct L3gd20_Spi *l3g, uint8_t _reg, uint8_t _val)
#define Int16FromBuf(_buf, _idx)
Driver for L3GD20 3-axis gyroscope from ST using SPI.
struct spi_transaction spi_trans
struct spi_periph * spi_p
volatile bool data_available
data ready flag
enum L3gd20ConfStatus init_status
init status
volatile uint8_t rx_buf[8]
union L3gd20_Spi::@329 data_rates
struct L3gd20Config config
bool initialized
config done flag
volatile uint8_t tx_buf[2]
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.