Paparazzi UAS  v5.8.2_stable-0-g6260b7c
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 "messages.h"
31 
32 //struct qr_code_spi_link_data qr_code_spi_link_data;
34 
35 static volatile bool_t 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  uint16_t x, y;
64  memcpy(&y, qr_code_spi_link_transaction.input_buf + 2, 2);
65  DOWNLINK_SEND_VISUALTARGET(DefaultChannel, DefaultDevice, &x, &y);
67  }
68 }
69 
70 static void qr_code_spi_link_trans_cb(struct spi_transaction *trans __attribute__((unused)))
71 {
73 }
74 
75 
unsigned short uint16_t
Definition: types.h:16
enum SPIClockPolarity cpol
clock polarity control
Definition: spi.h:149
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
#define FALSE
Definition: std.h:5
Architecture independent SPI (Serial Peripheral Interface) API.
enum SPIClockPhase cpha
clock phase control
Definition: spi.h:150
#define TRUE
Definition: std.h:4
Definition: spi.h:84
SPICallback after_cb
NULL or function called after the transaction.
Definition: spi.h:155
Inertial Measurement Unit interface.
uint16_t input_length
number of data words to read
Definition: spi.h:145
bool_t 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
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