38 #define GPS_I2C_SLAVE_ADDR (0x42 << 1)
40 #ifndef GPS_UBX_I2C_DEV
41 #error "GPS_UBX_I2C_DEV needs to be defined (e.g. to i2c1)"
43 PRINT_CONFIG_VAR(GPS_UBX_I2C_DEV)
45 #define GPS_I2C_ADDR_NB_AVAIL_BYTES 0xFD
46 #define GPS_I2C_ADDR_DATA 0xFF
99 gps_ubx_i2c_ucenter_done =
FALSE;
101 gps_ubx_i2c_ucenter_done =
TRUE;
133 for (i = 0; i < len; i++) {
161 gps_ubx_i2c_ucenter_done =
TRUE;
178 if (gps_ubx_i2c_bytes_to_read >
GPS_I2C_BUF_SIZE || gps_ubx_i2c_ucenter_done)
220 if (gps_ubx_i2c_bytes_to_read == 0xFFFF || gps_ubx_i2c_bytes_to_read == 0x0000)
uint16_t tx_buf_idx
tx buf index
#define GPS_I2C_ADDR_NB_AVAIL_BYTES
number of bytes available register
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
void gps_i2c_put_buffer(struct GpsUbxI2C *p, long fd, uint8_t *data, uint16_t len)
Put bytes into transmit buffer.
request size of ubx buffer
GpsI2CReadState read_state
pprz link device for Ublox over I2C
uint8_t gps_i2c_getch(struct GpsUbxI2C *p)
get a new char
void gps_ubx_i2c_periodic(void)
handle message sending
wait for gps_ubx to read buffer or ucenter to transmit
struct i2c_transaction trans
i2c transaction
uint8_t tx_buf[GPS_I2C_BUF_SIZE]
transmit buffer
uint16_t rx_buf_idx
rx buf index
void gps_i2c_put_byte(struct GpsUbxI2C *p, long fd, uint8_t data)
Put byte into transmit buffer.
void gps_ubx_i2c_read_event(void)
handle message reception
uint8_t rx_buf[GPS_I2C_BUF_SIZE]
receive buffer
void null_function(struct GpsUbxI2C *p)
null function
send a config msg and get reply
#define GPS_I2C_ADDR_DATA
data stream register
transaction set to done by user level
#define GPS_I2C_SLAVE_ADDR
bool tx_rdy
are we ready to transmit
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.
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.
struct link_device device
ppz link device
uint16_t rx_buf_avail
how many bytes are waiting to be read
uint16_t gps_ubx_i2c_bytes_to_read
ublox bytes to read
void gps_ubx_i2c_init(void)
init function
bool gps_i2c_tx_is_ready(void)
is driver ready to send a message
int gps_i2c_check_free_space(struct GpsUbxI2C *p, long *fd, uint16_t len)
Check available space in transmit buffer.
Common code for AP and FBW telemetry.
GpsI2CWriteState write_state
void gps_i2c_begin(void)
config is done, begin reading messages
read data from ubx buffer
void gps_i2c_msg_ready(struct GpsUbxI2C *p, long fd)
send buffer when ready
uint8_t gps_i2c_char_available(struct GpsUbxI2C *p)
check if a new character is available
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
bool gps_ubx_i2c_ucenter_done
ucenter finished configuring flag