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
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 
29 #define GPS_I2C_SLAVE_ADDR (0x42 << 1)
30 
31 #define GPS_I2C_BUF_SIZE 256
36 
38 
39 void gps_i2c_init(void);
40 void gps_i2c_event(void);
41 void gps_i2c_periodic(void);
42 
43 #define gps_i2cEvent() { if (gps_i2c_done) gps_i2c_event(); }
44 #define gps_i2cChAvailable() (gps_i2c_rx_insert_idx != gps_i2c_rx_extract_idx)
45 #define gps_i2cGetch() (gps_i2c_rx_buf[gps_i2c_rx_extract_idx++])
46 #define gps_i2cTransmit(_char) { \
47  if (! gps_i2c_data_ready_to_transmit) /* Else transmitting, overrun*/ \
48  gps_i2c_tx_buf[gps_i2c_tx_insert_idx++] = _char; \
49  }
50 #define gps_i2cSendMessage() { \
51  gps_i2c_data_ready_to_transmit = TRUE; \
52  gps_i2c_tx_extract_idx = 0; \
53  }
54 // #define gps_i2cTxRunning (gps_i2c_data_ready_to_transmit)
55 // #define gps_i2cInitParam(_baud, _uart_prm1, _uart_prm2) {}
56 
57 #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:69
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:31
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:82
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