Попытка реализовать очередь в чтении IMU. Неудача - HardFault
This commit is contained in:
@@ -24,11 +24,11 @@
|
||||
#define ACCEL_FCHOICE_ON 1
|
||||
#define ACCEL_FCHOICE_OFF 0
|
||||
|
||||
static volatile uint8_t i2c_busy = 0;
|
||||
/*static volatile uint8_t i2c_busy = 0;
|
||||
static uint8_t i2c_buf[16];
|
||||
static uint8_t i2c_len = 0;
|
||||
static uint8_t i2c_reg = 0;
|
||||
static uint8_t i2c_addr = 0;
|
||||
static uint8_t i2c_addr = 0;*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -36,7 +36,22 @@ typedef struct
|
||||
int16_t gx, gy, gz; // lsb
|
||||
} imu_raw_t;
|
||||
|
||||
static void (*i2c_callback)(uint8_t* buf) = 0;
|
||||
typedef struct I2C_Request
|
||||
{
|
||||
uint8_t addr;
|
||||
uint8_t reg;
|
||||
uint8_t *buf;
|
||||
uint8_t len;
|
||||
|
||||
void (*callback)(uint8_t*);
|
||||
|
||||
struct I2C_Request* next;
|
||||
} I2C_Request;
|
||||
|
||||
static I2C_Request* i2c_head = 0;
|
||||
static uint8_t i2c_busy = 0;
|
||||
|
||||
//static void (*i2c_callback)(uint8_t* buf) = 0;
|
||||
|
||||
void imu_pow_init();
|
||||
|
||||
@@ -50,7 +65,9 @@ void imu_tim6_init(const uint16_t freq);
|
||||
|
||||
void i2c_read(uint8_t addr, uint8_t reg, uint8_t* buf, uint8_t len);
|
||||
|
||||
uint8_t i2c_read_async(uint8_t addr, uint8_t reg, uint8_t len, void (*cb)(uint8_t*));
|
||||
void i2c_enqueue(I2C_Request* req);
|
||||
void i2c_start_next();
|
||||
void i2c_read_async(uint8_t addr, uint8_t reg, uint8_t len, void (*cb)(uint8_t*));
|
||||
|
||||
void i2c_write(uint8_t addr, uint8_t reg, uint8_t data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user