Skip to content
Snippets Groups Projects
Commit d0c7312a authored by dawehr's avatar dawehr
Browse files

wip: fix I2C stuff, and pass tests

parent 6a90cb93
No related branches found
No related tags found
No related merge requests found
...@@ -80,7 +80,8 @@ int zybo_i2c_write(struct I2CDriver *self, ...@@ -80,7 +80,8 @@ int zybo_i2c_write(struct I2CDriver *self,
unsigned short device_addr, unsigned short device_addr,
unsigned char *data, unsigned char *data,
unsigned int length) { unsigned int length) {
XIicPs *inst = self->state; struct ZyboI2CState *state = self->state;
XIicPs *inst = state->inst;
if (device_addr == PX4FLOW_DEVICE_ADDR) { if (device_addr == PX4FLOW_DEVICE_ADDR) {
// If we are sending a request to optical flow, drop down to 100kHz // If we are sending a request to optical flow, drop down to 100kHz
XIicPs_SetSClk(inst, 100000); XIicPs_SetSClk(inst, 100000);
...@@ -98,7 +99,8 @@ int zybo_i2c_read(struct I2CDriver *self, ...@@ -98,7 +99,8 @@ int zybo_i2c_read(struct I2CDriver *self,
unsigned short device_addr, unsigned short device_addr,
unsigned char *buff, unsigned char *buff,
unsigned int length) { unsigned int length) {
XIicPs *inst = self->state; struct ZyboI2CState *state = self->state;
XIicPs *inst = state->inst;
if (device_addr == PX4FLOW_DEVICE_ADDR) { if (device_addr == PX4FLOW_DEVICE_ADDR) {
// If we are sending a request to optical flow, drop down to 100kHz // If we are sending a request to optical flow, drop down to 100kHz
XIicPs_SetSClk(inst, 100000); XIicPs_SetSClk(inst, 100000);
......
...@@ -65,9 +65,9 @@ int test_zybo_i2c() { ...@@ -65,9 +65,9 @@ int test_zybo_i2c() {
int test_zybo_i2c_imu() { int test_zybo_i2c_imu() {
struct I2CDriver i2c = create_zybo_i2c(0); struct I2CDriver i2c = create_zybo_i2c(0);
struct IMUDriver imu = create_zybo_imu(&i2c); struct IMUDriver imu = create_zybo_imu(&i2c);
i2c.reset(&i2c);
gam_t gam; gam_t gam;
if (i2c.reset(&i2c)) return 0;
if (imu.reset(&imu, &gam)) return 0; if (imu.reset(&imu, &gam)) return 0;
int status = 0; int status = 0;
......
...@@ -48,7 +48,7 @@ int main() ...@@ -48,7 +48,7 @@ int main()
#ifdef RUN_TESTS #ifdef RUN_TESTS
//test_zybo_mio7_led_and_system(); //test_zybo_mio7_led_and_system();
//test_zybo_i2c(); //test_zybo_i2c();
//test_zybo_i2c_imu(); test_zybo_i2c_imu();
//test_zybo_i2c_px4flow(); //test_zybo_i2c_px4flow();
//test_zybo_i2c_lidar(); //test_zybo_i2c_lidar();
//test_zybo_i2c_all(); //test_zybo_i2c_all();
...@@ -56,7 +56,7 @@ int main() ...@@ -56,7 +56,7 @@ int main()
//test_zybo_motors(); //test_zybo_motors();
//test_zybo_uart(); //test_zybo_uart();
//test_zybo_axi_timer(); //test_zybo_axi_timer();
test_zybo_uart_comm(); //test_zybo_uart_comm();
return 0; return 0;
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment