Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
pprz link device for Ublox over I2C More...
#include "mcu_periph/i2c.h"
#include "modules/gps/gps_ubx_i2c.h"
#include "modules/datalink/downlink.h"
#include <math.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | GPS_I2C_SLAVE_ADDR (0x42 << 1) |
#define | GPS_I2C_ADDR_NB_AVAIL_BYTES 0xFD |
number of bytes available register More... | |
#define | GPS_I2C_ADDR_DATA 0xFF |
data stream register More... | |
Functions | |
void | null_function (struct GpsUbxI2C *p, uint32_t baudrate) |
null function More... | |
int | gps_i2c_check_free_space (struct GpsUbxI2C *p, long *fd, uint16_t len) |
Check available space in transmit buffer. More... | |
void | gps_i2c_put_byte (struct GpsUbxI2C *p, long fd, uint8_t data) |
Put byte into transmit buffer. More... | |
void | gps_i2c_put_buffer (struct GpsUbxI2C *p, long fd, uint8_t *data, uint16_t len) |
Put bytes into transmit buffer. More... | |
void | gps_i2c_msg_ready (struct GpsUbxI2C *p, long fd) |
send buffer when ready More... | |
int | gps_i2c_char_available (struct GpsUbxI2C *p) |
check if a new character is available More... | |
uint8_t | gps_i2c_getch (struct GpsUbxI2C *p) |
get a new char More... | |
void | gps_ubx_i2c_init (void) |
init function More... | |
bool | gps_i2c_tx_is_ready (void) |
is driver ready to send a message More... | |
void | gps_i2c_begin (void) |
config is done, begin reading messages More... | |
void | gps_ubx_i2c_periodic (void) |
handle message sending More... | |
void | gps_ubx_i2c_read_event (void) |
handle message reception More... | |
Variables | |
struct GpsUbxI2C | gps_i2c |
bool | gps_ubx_i2c_ucenter_done |
ucenter finished configuring flag More... | |
uint16_t | gps_ubx_i2c_bytes_to_read |
ublox bytes to read More... | |
pprz link device for Ublox over I2C
This module adds i2c functionality for the ublox using existing driver
Definition in file gps_ubx_i2c.c.
#define GPS_I2C_ADDR_DATA 0xFF |
data stream register
Definition at line 47 of file gps_ubx_i2c.c.
#define GPS_I2C_ADDR_NB_AVAIL_BYTES 0xFD |
number of bytes available register
Definition at line 46 of file gps_ubx_i2c.c.
#define GPS_I2C_SLAVE_ADDR (0x42 << 1) |
Definition at line 39 of file gps_ubx_i2c.c.
void gps_i2c_begin | ( | void | ) |
config is done, begin reading messages
Definition at line 160 of file gps_ubx_i2c.c.
References gps_ubx_i2c_ucenter_done, and TRUE.
Referenced by gps_ubx_ucenter_periodic().
int gps_i2c_char_available | ( | struct GpsUbxI2C * | p | ) |
check if a new character is available
p | unused |
Definition at line 150 of file gps_ubx_i2c.c.
References gps_i2c, GpsUbxI2C::rx_buf_avail, and GpsUbxI2C::rx_buf_idx.
Referenced by gps_ubx_i2c_init(), and gps_ubx_i2c_periodic().
Check available space in transmit buffer.
p | unused |
fd | unused |
len | number of bytes to check |
Definition at line 126 of file gps_ubx_i2c.c.
References gps_i2c, GPS_I2C_BUF_SIZE, and GpsUbxI2C::tx_buf_idx.
Referenced by gps_ubx_i2c_init().
get a new char
p | unused |
Definition at line 165 of file gps_ubx_i2c.c.
References gps_i2c, GpsUbxI2C::rx_buf, and GpsUbxI2C::rx_buf_idx.
Referenced by gps_ubx_i2c_init().
void gps_i2c_msg_ready | ( | struct GpsUbxI2C * | p, |
long | fd | ||
) |
send buffer when ready
p | unused |
Definition at line 144 of file gps_ubx_i2c.c.
References FALSE, gps_i2c, gps_i2c_write_cfg, GpsUbxI2C::tx_rdy, and GpsUbxI2C::write_state.
Referenced by gps_ubx_i2c_init().
Put bytes into transmit buffer.
p | unused |
fd | unused |
data | byte to put in buffer |
Definition at line 131 of file gps_ubx_i2c.c.
References fd, gps_i2c_put_byte(), and p.
Referenced by gps_ubx_i2c_init().
Put byte into transmit buffer.
p | unused |
fd | unused |
data | byte to put in buffer |
Definition at line 139 of file gps_ubx_i2c.c.
References gps_i2c, GpsUbxI2C::tx_buf, and GpsUbxI2C::tx_buf_idx.
Referenced by gps_i2c_put_buffer(), and gps_ubx_i2c_init().
bool gps_i2c_tx_is_ready | ( | void | ) |
is driver ready to send a message
Definition at line 155 of file gps_ubx_i2c.c.
References gps_i2c, and GpsUbxI2C::tx_rdy.
Referenced by gps_ubx_ucenter_periodic().
void gps_ubx_i2c_init | ( | void | ) |
init function
< check if transmit buffer is not full
< put one byte
< put several bytes
< send completed buffer
< check if a new character is available
< get a new char
< set device baudrate
Definition at line 97 of file gps_ubx_i2c.c.
References GpsUbxI2C::device, FALSE, gps_i2c, gps_i2c_char_available(), gps_i2c_check_free_space(), gps_i2c_getch(), gps_i2c_msg_ready(), gps_i2c_put_buffer(), gps_i2c_put_byte(), gps_i2c_read_standby, gps_i2c_write_standby, gps_ubx_i2c_ucenter_done, I2CTransDone, null_function(), GpsUbxI2C::read_state, GpsUbxI2C::rx_buf_avail, GpsUbxI2C::rx_buf_idx, i2c_transaction::status, GpsUbxI2C::trans, TRUE, GpsUbxI2C::tx_buf_idx, GpsUbxI2C::tx_rdy, and GpsUbxI2C::write_state.
void gps_ubx_i2c_periodic | ( | void | ) |
handle message sending
Definition at line 170 of file gps_ubx_i2c.c.
References i2c_transaction::buf, gps_i2c, GPS_I2C_ADDR_NB_AVAIL_BYTES, GPS_I2C_BUF_SIZE, gps_i2c_char_available(), gps_i2c_read_sizeof, gps_i2c_read_standby, GPS_I2C_SLAVE_ADDR, gps_i2c_write_cfg, gps_i2c_write_request_size, gps_i2c_write_standby, gps_ubx_i2c_bytes_to_read, gps_ubx_i2c_ucenter_done, i2c_transceive(), i2c_transmit(), I2CTransDone, GpsUbxI2C::read_state, i2c_transaction::status, GpsUbxI2C::trans, TRUE, GpsUbxI2C::tx_buf, GpsUbxI2C::tx_buf_idx, GpsUbxI2C::tx_rdy, and GpsUbxI2C::write_state.
void gps_ubx_i2c_read_event | ( | void | ) |
handle message reception
Definition at line 209 of file gps_ubx_i2c.c.
References i2c_transaction::buf, gps_i2c, GPS_I2C_ADDR_DATA, GPS_I2C_BUF_SIZE, gps_i2c_read_data, gps_i2c_read_sizeof, gps_i2c_read_standby, GPS_I2C_SLAVE_ADDR, gps_i2c_write_request_size, gps_i2c_write_standby, gps_ubx_i2c_bytes_to_read, i2c_transceive(), I2CTransDone, GpsUbxI2C::read_state, GpsUbxI2C::rx_buf, GpsUbxI2C::rx_buf_avail, GpsUbxI2C::rx_buf_idx, i2c_transaction::status, GpsUbxI2C::trans, and GpsUbxI2C::write_state.
Referenced by GpsUbxi2cEvent().
null function
p | unused |
Definition at line 124 of file gps_ubx_i2c.c.
Referenced by gps_ubx_i2c_init().
struct GpsUbxI2C gps_i2c |
Definition at line 1 of file gps_ubx_i2c.c.
Referenced by gps_i2c_char_available(), gps_i2c_check_free_space(), gps_i2c_getch(), gps_i2c_msg_ready(), gps_i2c_put_byte(), gps_i2c_tx_is_ready(), gps_ubx_i2c_init(), gps_ubx_i2c_periodic(), gps_ubx_i2c_read_event(), and GpsUbxi2cEvent().
uint16_t gps_ubx_i2c_bytes_to_read |
ublox bytes to read
Definition at line 54 of file gps_ubx_i2c.c.
Referenced by gps_ubx_i2c_periodic(), and gps_ubx_i2c_read_event().
bool gps_ubx_i2c_ucenter_done |
ucenter finished configuring flag
Definition at line 53 of file gps_ubx_i2c.c.
Referenced by gps_i2c_begin(), gps_ubx_i2c_init(), and gps_ubx_i2c_periodic().