Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
eeprom25AA256.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  */
21 
31 #ifndef EEPROM25AA256_H
32 #define EEPROM25AA256_H
33 
34 #include "std.h"
35 #include "mcu_periph/spi.h"
36 
42 #ifndef E25_IN_BUFFER_LEN
43 #define E25_IN_BUFFER_LEN (1024 + 3)
44 #endif
45 
51 #ifndef E25_OUT_BUFFER_LEN
52 #define E25_OUT_BUFFER_LEN 3
53 #endif
54 
57 struct Eeprom25AA256 {
58  struct spi_periph *spi_p;
63 };
64 
71 extern void eeprom25AA256_init(struct Eeprom25AA256 *eeprom, struct spi_periph *spi_p, uint8_t slave_idx);
72 
79 extern void eeprom25AA256_read(struct Eeprom25AA256 *eeprom, uint16_t addr, uint16_t length);
80 
85 extern void eeprom25AA256_event(struct Eeprom25AA256 *eeprom);
86 
87 #endif // EEPROM25AA256_H
88 
unsigned short uint16_t
Definition: types.h:16
struct spi_transaction spi_trans
spi transaction
Definition: eeprom25AA256.h:59
void eeprom25AA256_event(struct Eeprom25AA256 *eeprom)
Event function.
Definition: eeprom25AA256.c:89
SPI transaction structure.
Definition: spi.h:142
void eeprom25AA256_read(struct Eeprom25AA256 *eeprom, uint16_t addr, uint16_t length)
Read function.
Definition: eeprom25AA256.c:72
struct spi_periph * spi_p
spi peripheral
Definition: eeprom25AA256.h:58
bool data_available
data read flag
Definition: eeprom25AA256.h:62
#define E25_OUT_BUFFER_LEN
Output buffer length.
Definition: eeprom25AA256.h:52
Architecture independent SPI (Serial Peripheral Interface) API.
SPI peripheral structure.
Definition: spi.h:168
#define E25_IN_BUFFER_LEN
Input buffer length.
Definition: eeprom25AA256.h:43
25AA256 eeprom structure
Definition: eeprom25AA256.h:57
unsigned char uint8_t
Definition: types.h:14
volatile uint8_t rx_buf[E25_IN_BUFFER_LEN]
receive buffer
Definition: eeprom25AA256.h:61
volatile uint8_t tx_buf[E25_OUT_BUFFER_LEN]
transmit buffer
Definition: eeprom25AA256.h:60
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
Definition: spi.h:147
void eeprom25AA256_init(struct Eeprom25AA256 *eeprom, struct spi_periph *spi_p, uint8_t slave_idx)
Init function.
Definition: eeprom25AA256.c:45