Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
lisa_test_adxl345_dma.c File Reference
#include "libopencm3/stm32/f1/gpio.h"
#include "libopencm3/stm32/f1/nvic.h"
#include "libopencm3/stm32/exti.h"
#include <BOARD_CONFIG>
#include "mcu.h"
#include "mcu_periph/sys_time.h"
#include "mcu_periph/uart.h"
#include "subsystems/datalink/downlink.h"
#include "mcu_periph/spi.h"
#include "peripherals/adxl345_regs.h"
#include "led.h"
+ Include dependency graph for lisa_test_adxl345_dma.c:

Go to the source code of this file.

Macros

#define ADXL345_SLAVE_IDX   SPI_SLAVE2
 
#define ADXL345_SPI_DEV   spi2
 
#define CONFIGURED   6
 
#define Int16FromBuf(_buf, _idx)   ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))
 

Functions

static void write_to_reg (uint8_t addr, uint8_t val)
 
static void adxl345_trans_cb (struct spi_transaction *trans)
 
static void init_adxl345_spi_trans (void)
 
static void read_data (void)
 
static void main_init (void)
 
static void main_periodic_task (void)
 
static void main_event_task (void)
 
void hw_init (void)
 
int main (void)
 
void exti2_isr (void)
 

Variables

static uint8_t acc_status =0
 
static volatile uint8_t acc_data_available = FALSE
 
static volatile uint8_t foo = FALSE
 
struct spi_transaction adxl345_spi_trans
 
static uint8_t dma_tx_buf [7]
 
static uint8_t dma_rx_buf [7]
 

Macro Definition Documentation

#define ADXL345_SLAVE_IDX   SPI_SLAVE2

Definition at line 37 of file lisa_test_adxl345_dma.c.

Referenced by init_adxl345_spi_trans().

#define ADXL345_SPI_DEV   spi2

Definition at line 41 of file lisa_test_adxl345_dma.c.

Referenced by read_data(), and write_to_reg().

#define CONFIGURED   6

Definition at line 44 of file lisa_test_adxl345_dma.c.

Referenced by main_event_task(), and main_periodic_task().

#define Int16FromBuf (   _buf,
  _idx 
)    ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))

Definition at line 108 of file lisa_test_adxl345_dma.c.

Referenced by main_event_task().

Function Documentation

static void adxl345_trans_cb ( struct spi_transaction trans)
static

Definition at line 145 of file lisa_test_adxl345_dma.c.

References acc_data_available, and TRUE.

Referenced by init_adxl345_spi_trans().

+ Here is the caller graph for this function:

void exti2_isr ( void  )

Definition at line 178 of file lisa_test_adxl345_dma.c.

References foo, LED_TOGGLE, and TRUE.

void hw_init ( void  )

Definition at line 164 of file lisa_test_adxl345_dma.c.

Referenced by main_init().

+ Here is the caller graph for this function:

int main ( void  )

Definition at line 64 of file lisa_test_adxl345_dma.c.

References main_event_task(), main_init(), main_periodic_task(), and sys_time_check_and_ack_timer().

+ Here is the call graph for this function:

static void main_event_task ( void  )
inlinestatic

Definition at line 110 of file lisa_test_adxl345_dma.c.

References acc_data_available, acc_status, CONFIGURED, DefaultChannel, DefaultDevice, dma_rx_buf, FALSE, foo, Int16FromBuf, and LED_TOGGLE.

Referenced by main().

+ Here is the caller graph for this function:

static void main_init ( void  )
inlinestatic

Definition at line 76 of file lisa_test_adxl345_dma.c.

References hw_init(), init_adxl345_spi_trans(), mcu_init(), PERIODIC_FREQUENCY, and sys_time_register_timer().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void main_periodic_task ( void  )
inlinestatic

Definition at line 83 of file lisa_test_adxl345_dma.c.

References acc_status, ADXL345_REG_BW_RATE, ADXL345_REG_DATA_FORMAT, ADXL345_REG_INT_ENABLE, ADXL345_REG_POWER_CTL, CONFIGURED, DefaultChannel, DefaultDevice, LED_PERIODIC, read_data(), and write_to_reg().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void read_data ( void  )
static

Definition at line 137 of file lisa_test_adxl345_dma.c.

References ADXL345_REG_DATA_X0, ADXL345_SPI_DEV, adxl345_spi_trans, dma_tx_buf, spi_transaction::input_length, spi_transaction::output_length, and spi_submit().

Referenced by main_periodic_task().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void write_to_reg ( uint8_t  addr,
uint8_t  val 
)
static

Definition at line 127 of file lisa_test_adxl345_dma.c.

References ADXL345_SPI_DEV, adxl345_spi_trans, dma_tx_buf, spi_transaction::input_length, spi_transaction::output_length, spi_submit(), SPITransSuccess, spi_transaction::status, and val.

Referenced by main_periodic_task().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

volatile uint8_t acc_data_available = FALSE
static

Definition at line 46 of file lisa_test_adxl345_dma.c.

Referenced by adxl345_trans_cb(), and main_event_task().

uint8_t acc_status =0
static

Definition at line 45 of file lisa_test_adxl345_dma.c.

Referenced by main_event_task(), and main_periodic_task().

struct spi_transaction adxl345_spi_trans

Definition at line 48 of file lisa_test_adxl345_dma.c.

Referenced by init_adxl345_spi_trans(), read_data(), and write_to_reg().

uint8_t dma_rx_buf[7]
static

Definition at line 51 of file lisa_test_adxl345_dma.c.

Referenced by init_adxl345_spi_trans(), and main_event_task().

uint8_t dma_tx_buf[7]
static

Definition at line 50 of file lisa_test_adxl345_dma.c.

Referenced by init_adxl345_spi_trans(), read_data(), and write_to_reg().

volatile uint8_t foo = FALSE
static

Definition at line 47 of file lisa_test_adxl345_dma.c.

Referenced by exti2_isr(), and main_event_task().