6 years ago.

I'm trying to read data from px4flow using nucleo f446re. But the code below doesn't seem to work.

/media/uploads/makaan/px4flowforques.cpp

1 Answer

5 years, 2 months ago.

Here are the two packages, the first one is the 22 byte 0x00 packet and the second is 26 at 0x16. Also the values come in low byte first so say data[1] << 8) | data [0]

typedef struct i2c_frame { uint16_t frame_count; int16_t pixel_flow_x_sum; int16_t pixel_flow_y_sum; int16_t flow_comp_m_x; int16_t flow_comp_m_y; int16_t qual; int16_t gyro_x_rate; int16_t gyro_y_rate; int16_t gyro_z_rate; uint8_t gyro_range; uint8_t sonar_timestamp; int16_t ground_distance; } i2c_frame;

  1. define I2C_FRAME_SIZE (sizeof(i2c_frame))

typedef struct i2c_integral_frame { uint16_t frame_count_since_last_readout; int16_t pixel_flow_x_integral; int16_t pixel_flow_y_integral; int16_t gyro_x_rate_integral; int16_t gyro_y_rate_integral; int16_t gyro_z_rate_integral; uint32_t integration_timespan; uint32_t sonar_timestamp; uint16_t ground_distance; int16_t gyro_temperature; uint8_t qual; } i2c_integral_frame;

You can make your code more readable for others. Just click on the Edit button and enclose it with <<code>> and <</code>> tags (each on separate line)

<<code>>
your source code
<</code>>
posted by Zoltan Hudak 02 Mar 2019