Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
mcp355x.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Gautier Hattenberger
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 
27 #include "peripherals/mcp355x.h"
28 #include "mcu_periph/spi.h"
29 
33 
35 
36 void mcp355x_init(void)
37 {
38  mcp355x_data_available = false;
39  mcp355x_data = 0;
40 
47 
53 }
54 
55 void mcp355x_read(void)
56 {
58 }
59 
60 void mcp355x_event(void)
61 {
63  if ((mcp355x_spi_trans.input_buf[0] >> 4) == 0) {
68  (mcp355x_spi_trans.input_buf[3] >> 7));
70  }
72  }
75  }
76 }
77 
mcp355x.h
spi_transaction::cdiv
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
Definition: spi.h:159
mcp355x_data_available
bool mcp355x_data_available
Definition: mcp355x.c:30
spi_transaction::cpol
enum SPIClockPolarity cpol
clock polarity control
Definition: spi.h:155
spi_transaction::output_length
uint16_t output_length
number of data words to write
Definition: spi.h:152
spi.h
mcp355x_data
int32_t mcp355x_data
Definition: mcp355x.c:31
spi_transaction
SPI transaction structure.
Definition: spi.h:148
uint32_t
unsigned long uint32_t
Definition: types.h:18
mcp355x_val
uint8_t mcp355x_val[4]
Definition: mcp355x.c:32
SPITransSuccess
@ SPITransSuccess
Definition: spi.h:99
spi_transaction::bitorder
enum SPIBitOrder bitorder
MSB/LSB order.
Definition: spi.h:158
spi_transaction::output_buf
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
Definition: spi.h:150
spi_transaction::select
enum SPISlaveSelect select
slave selection behavior
Definition: spi.h:154
SPICphaEdge1
@ SPICphaEdge1
CPHA = 0.
Definition: spi.h:74
SPIMSBFirst
@ SPIMSBFirst
Definition: spi.h:112
SPICpolIdleLow
@ SPICpolIdleLow
CPOL = 0.
Definition: spi.h:83
spi_transaction::cpha
enum SPIClockPhase cpha
clock phase control
Definition: spi.h:156
spi_submit
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
Definition: spi_arch.c:511
SPITransFailed
@ SPITransFailed
Definition: spi.h:100
mcp355x_spi_trans
struct spi_transaction mcp355x_spi_trans
Definition: mcp355x.c:34
uint8_t
unsigned char uint8_t
Definition: types.h:14
mcp355x_init
void mcp355x_init(void)
Definition: mcp355x.c:36
SPI_SLAVE0
#define SPI_SLAVE0
Definition: spi.h:192
SPIDss8bit
@ SPIDss8bit
Definition: spi.h:90
SPIDiv64
@ SPIDiv64
Definition: spi.h:125
spi_transaction::input_length
uint16_t input_length
number of data words to read
Definition: spi.h:151
spi_transaction::dss
enum SPIDataSizeSelect dss
data transfer word size
Definition: spi.h:157
spi_transaction::slave_idx
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
Definition: spi.h:153
int32_t
signed long int32_t
Definition: types.h:19
SPITransDone
@ SPITransDone
Definition: spi.h:101
SPISelect
@ SPISelect
slave is selected before transaction but not unselected
Definition: spi.h:64
spi_transaction::input_buf
volatile uint8_t * input_buf
pointer to receive buffer for DMA
Definition: spi.h:149
spi1
process_rx_dma_interrupt & spi1
receive transferred over DMA
Definition: spi_arch.c:967
mcp355x_read
void mcp355x_read(void)
Definition: mcp355x.c:55
mcp355x_event
void mcp355x_event(void)
Definition: mcp355x.c:60
spi_transaction::status
enum SPITransactionStatus status
Definition: spi.h:162