Paparazzi UAS  v5.15_devel-113-g1b57ff1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qr_code_spi_link.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2013 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
23 #include "qr_code_spi_link.h"
24 
25 #include "subsystems/imu.h"
26 #include "mcu_periph/spi.h"
27 
28 #include "mcu_periph/uart.h"
29 #include "pprzlink/messages.h"
31 
32 //struct qr_code_spi_link_data qr_code_spi_link_data;
34 
35 static volatile bool qr_code_spi_data_available = false;
36 
37 uint8_t testDataOut[3] = {1, 2, 3};
38 uint8_t testDataIn[3] = {9, 9, 9};
39 
40 static void qr_code_spi_link_trans_cb(struct spi_transaction *trans);
41 
43 {
53  //spi_slave_set_config(&spi1, &qr_code_spi_link_transaction);
55 }
56 
57 
59 {
62  int16_t x, y;
63  int16_t w=0, h=0;
64  uint16_t source = 1;
65  static uint16_t cnt = 0;
66  cnt++;
68  memcpy(&y, qr_code_spi_link_transaction.input_buf + 2, 2);
69  DOWNLINK_SEND_VISUALTARGET(DefaultChannel, DefaultDevice, &cnt, &x, &y, &w,&h, &source);
71  }
72 }
73 
74 static void qr_code_spi_link_trans_cb(struct spi_transaction *trans __attribute__((unused)))
75 {
77 }
78 
79 
unsigned short uint16_t
Definition: types.h:16
enum SPIClockPolarity cpol
clock polarity control
Definition: spi.h:149
bool spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
Register one (and only one) transaction to use spi as slave.
Definition: spi_arch.c:679
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
uint16_t output_length
number of data words to write
Definition: spi.h:146
CPHA = 1.
Definition: spi.h:69
SPI transaction structure.
Definition: spi.h:142
CPOL = 1.
Definition: spi.h:78
enum SPIBitOrder bitorder
MSB/LSB order.
Definition: spi.h:152
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
Definition: spi.h:144
Architecture independent SPI (Serial Peripheral Interface) API.
enum SPIClockPhase cpha
clock phase control
Definition: spi.h:150
Definition: spi.h:84
SPICallback after_cb
NULL or function called after the transaction.
Definition: spi.h:155
signed short int16_t
Definition: types.h:17
Inertial Measurement Unit interface.
uint16_t input_length
number of data words to read
Definition: spi.h:145
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
unsigned char uint8_t
Definition: types.h:14
enum SPIDataSizeSelect dss
data transfer word size
Definition: spi.h:151
volatile uint8_t * input_buf
pointer to receive buffer for DMA
Definition: spi.h:143
process_rx_dma_interrupt & spi1
receive transferred over DMA
Definition: spi_arch.c:967