Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gps_i2c.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 ENAC, Pascal Brisset, Michel Gorraz,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  */
22 
23 #ifndef GPS_I2C
24 #define GPS_I2C
25 
26 #include "std.h"
27 
28 #define GPS_I2C_SLAVE_ADDR (0x42 << 1)
29 
30 #define GPS_I2C_BUF_SIZE 256
35 
37 
38 void gps_i2c_init(void);
39 void gps_i2c_event(void);
40 void gps_i2c_periodic(void);
41 
42 #define gps_i2cEvent() { if (gps_i2c_done) gps_i2c_event(); }
43 #define gps_i2cChAvailable() (gps_i2c_rx_insert_idx != gps_i2c_rx_extract_idx)
44 #define gps_i2cGetch() (gps_i2c_rx_buf[gps_i2c_rx_extract_idx++])
45 #define gps_i2cTransmit(_char) { \
46  if (! gps_i2c_data_ready_to_transmit) /* Else transmitting, overrun*/ \
47  gps_i2c_tx_buf[gps_i2c_tx_insert_idx++] = _char; \
48 }
49 #define gps_i2cSendMessage() { \
50  gps_i2c_data_ready_to_transmit = TRUE; \
51  gps_i2c_tx_extract_idx = 0; \
52 }
53 // #define gps_i2cTxRunning (gps_i2c_data_ready_to_transmit)
54 // #define gps_i2cInitParam(_baud, _uart_prm1, _uart_prm2) {}
55 
56 #endif // GPS_I2C
uint8_t gps_i2c_tx_buf[GPS_I2C_BUF_SIZE]
Definition: gps_i2c.c:32
void gps_i2c_periodic(void)
Definition: gps_i2c.c:68
bool_t gps_i2c_data_ready_to_transmit
Definition: gps_i2c.c:34
uint8_t gps_i2c_rx_extract_idx
Definition: gps_i2c.c:31
#define GPS_I2C_BUF_SIZE
Definition: gps_i2c.h:30
void gps_i2c_init(void)
Definition: gps_i2c.c:55
bool_t gps_i2c_done
Definition: gps_i2c.c:34
uint8_t gps_i2c_rx_buf[GPS_I2C_BUF_SIZE]
Definition: gps_i2c.c:30
void gps_i2c_event(void)
Definition: gps_i2c.c:80
uint8_t gps_i2c_tx_insert_idx
Definition: gps_i2c.c:33
unsigned char uint8_t
Definition: types.h:14
uint8_t gps_i2c_tx_extract_idx
Definition: gps_i2c.c:33
uint8_t gps_i2c_rx_insert_idx
Definition: gps_i2c.c:31