Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
gps_ubx_i2c.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009 ENAC, Pascal Brisset, Michel Gorraz,Gautier Hattenberger,
3 * 2016 Michael Sierra <sierramichael.a@gmail.com>
4 *
5 * This file is part of paparazzi.
6 *
7 * paparazzi is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * paparazzi is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with paparazzi; see the file COPYING. If not, write to
19 * the Free Software Foundation, 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 *
22 */
23
32#ifndef GPS_UBX_I2C_H
33#define GPS_UBX_I2C_H
34
35#include "std.h"
36#include "mcu_periph/i2c.h"
37#include "pprzlink/pprzlink_device.h"
38
39#define GPS_I2C_BUF_SIZE 255
40
49
58
81
82extern struct GpsUbxI2C gps_i2c;
85extern void gps_ubx_i2c_init(void);
88extern void gps_ubx_i2c_periodic(void);
91extern void gps_ubx_i2c_read_event(void);
94extern bool gps_i2c_tx_is_ready(void);
97extern void gps_i2c_begin(void);
98
101static inline void GpsUbxi2cEvent(void)
102{
105 } else if (gps_i2c.trans.status == I2CTransFailed) {
106 // if transaction failed, mark as done so can be retried
108 }
109}
110
111#endif // GPS_UBX_I2C_H
void gps_ubx_i2c_init(void)
init function
Definition gps_ubx_i2c.c:97
struct i2c_transaction trans
i2c transaction
Definition gps_ubx_i2c.h:75
void gps_i2c_begin(void)
config is done, begin reading messages
uint16_t rx_buf_avail
how many bytes are waiting to be read
Definition gps_ubx_i2c.h:69
uint16_t tx_buf_idx
tx buf index
Definition gps_ubx_i2c.h:71
uint16_t rx_buf_idx
rx buf index
Definition gps_ubx_i2c.h:70
struct GpsUbxI2C gps_i2c
Definition gps_ubx_i2c.c:50
GpsI2CReadState
read states
Definition gps_ubx_i2c.h:44
@ gps_i2c_read_data
read data from ubx buffer
Definition gps_ubx_i2c.h:47
@ gps_i2c_read_standby
dont read anything
Definition gps_ubx_i2c.h:45
@ gps_i2c_read_sizeof
read size of ubx buffer
Definition gps_ubx_i2c.h:46
static void GpsUbxi2cEvent(void)
i2c event
bool tx_rdy
are we ready to transmit
Definition gps_ubx_i2c.h:73
bool gps_i2c_tx_is_ready(void)
is driver ready to send a message
void gps_ubx_i2c_periodic(void)
handle message sending
uint8_t tx_buf[GPS_I2C_BUF_SIZE]
transmit buffer
Definition gps_ubx_i2c.h:67
#define GPS_I2C_BUF_SIZE
Definition gps_ubx_i2c.h:39
void gps_ubx_i2c_read_event(void)
handle message reception
struct link_device device
ppz link device
Definition gps_ubx_i2c.h:79
uint8_t rx_buf[GPS_I2C_BUF_SIZE]
receive buffer
Definition gps_ubx_i2c.h:66
GpsI2CWriteState
write states
Definition gps_ubx_i2c.h:53
@ gps_i2c_write_cfg
send a config msg and get reply
Definition gps_ubx_i2c.h:56
@ gps_i2c_write_request_size
request size of ubx buffer
Definition gps_ubx_i2c.h:55
@ gps_i2c_write_standby
wait for gps_ubx to read buffer or ucenter to transmit
Definition gps_ubx_i2c.h:54
GpsI2CReadState read_state
Definition gps_ubx_i2c.h:63
int baudrate
baudrate, unused
Definition gps_ubx_i2c.h:77
GpsI2CWriteState write_state
Definition gps_ubx_i2c.h:64
ubx_i2c state
Definition gps_ubx_i2c.h:62
enum I2CTransactionStatus status
Transaction status.
Definition i2c.h:126
@ I2CTransSuccess
transaction successfully finished by I2C driver
Definition i2c.h:57
@ I2CTransFailed
transaction failed
Definition i2c.h:58
@ I2CTransDone
transaction set to done by user level
Definition i2c.h:59
I2C transaction structure.
Definition i2c.h:93
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
uint16_t foo
Definition main_demo5.c:58
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.