39 #define GPS_I2C_SLAVE_ADDR (0x42 << 1)
41 #ifndef GPS_UBX_I2C_DEV
42 #error "GPS_UBX_I2C_DEV needs to be defined (e.g. to i2c1)"
44 PRINT_CONFIG_VAR(GPS_UBX_I2C_DEV)
46 #define GPS_I2C_ADDR_NB_AVAIL_BYTES 0xFD
47 #define GPS_I2C_ADDR_DATA 0xFF
134 for (i = 0; i < len; i++) {
Common code for AP and FBW telemetry.
void gps_ubx_i2c_init(void)
init function
#define GPS_I2C_ADDR_DATA
data stream register
void gps_i2c_begin(void)
config is done, begin reading messages
int gps_i2c_check_free_space(struct GpsUbxI2C *p, long *fd, uint16_t len)
Check available space in transmit buffer.
uint8_t gps_i2c_getch(struct GpsUbxI2C *p)
get a new char
bool gps_ubx_i2c_ucenter_done
ucenter finished configuring flag
uint16_t gps_ubx_i2c_bytes_to_read
ublox bytes to read
bool gps_i2c_tx_is_ready(void)
is driver ready to send a message
#define GPS_I2C_ADDR_NB_AVAIL_BYTES
number of bytes available register
void gps_ubx_i2c_periodic(void)
handle message sending
#define GPS_I2C_SLAVE_ADDR
void gps_ubx_i2c_read_event(void)
handle message reception
void gps_i2c_put_byte(struct GpsUbxI2C *p, long fd, uint8_t data)
Put byte into transmit buffer.
void gps_i2c_msg_ready(struct GpsUbxI2C *p, long fd)
send buffer when ready
int gps_i2c_char_available(struct GpsUbxI2C *p)
check if a new character is available
void gps_i2c_put_buffer(struct GpsUbxI2C *p, long fd, uint8_t *data, uint16_t len)
Put bytes into transmit buffer.
void null_function(struct GpsUbxI2C *p, uint32_t baudrate)
null function
pprz link device for Ublox over I2C
struct i2c_transaction trans
i2c transaction
uint16_t rx_buf_avail
how many bytes are waiting to be read
uint16_t tx_buf_idx
tx buf index
uint16_t rx_buf_idx
rx buf index
@ gps_i2c_read_data
read data from ubx buffer
@ gps_i2c_read_standby
dont read anything
@ gps_i2c_read_sizeof
read size of ubx buffer
bool tx_rdy
are we ready to transmit
uint8_t tx_buf[GPS_I2C_BUF_SIZE]
transmit buffer
struct link_device device
ppz link device
uint8_t rx_buf[GPS_I2C_BUF_SIZE]
receive buffer
@ gps_i2c_write_cfg
send a config msg and get reply
@ gps_i2c_write_request_size
request size of ubx buffer
@ gps_i2c_write_standby
wait for gps_ubx to read buffer or ucenter to transmit
GpsI2CReadState read_state
int baudrate
baudrate, unused
GpsI2CWriteState write_state
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
enum I2CTransactionStatus status
Transaction status.
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
bool i2c_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction.
@ I2CTransDone
transaction set to done by user level
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.