Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 "modules/imu/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 
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
enum SPIClockPolarity cpol
clock polarity control
Definition: spi.h:155
enum SPIClockPhase cpha
clock phase control
Definition: spi.h:156
SPICallback after_cb
NULL or function called after the transaction.
Definition: spi.h:161
enum SPIDataSizeSelect dss
data transfer word size
Definition: spi.h:157
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
Definition: spi.h:150
uint16_t input_length
number of data words to read
Definition: spi.h:151
volatile uint8_t * input_buf
pointer to receive buffer for DMA
Definition: spi.h:149
enum SPIBitOrder bitorder
MSB/LSB order.
Definition: spi.h:158
uint16_t output_length
number of data words to write
Definition: spi.h:152
bool spi_slave_register(struct spi_periph *periph, struct spi_transaction *trans)
Register a spi transaction in slave mode (only one transaction can be registered).
Definition: spi_arch.c:1624
process_rx_dma_interrupt & spi1
receive transferred over DMA
Definition: spi_arch.c:967
@ SPICphaEdge2
CPHA = 1.
Definition: spi.h:75
@ SPICpolIdleHigh
CPOL = 1.
Definition: spi.h:84
@ SPIMSBFirst
Definition: spi.h:112
@ SPIDss8bit
Definition: spi.h:90
SPI transaction structure.
Definition: spi.h:148
Inertial Measurement Unit interface.
Architecture independent SPI (Serial Peripheral Interface) API.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
short int16_t
Typedef defining 16 bit short type.
Definition: vl53l1_types.h:93
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98