Ben Willems / Mbed 2 deprecated MLX90418_I2C_master_bwi

Dependencies:   mbed

Revision:
15:83bbc18cccbc
Parent:
14:062850afdf38
Child:
16:a0bfe33f8a4a
diff -r 062850afdf38 -r 83bbc18cccbc main.cpp
--- a/main.cpp	Thu Apr 22 11:35:17 2021 +0000
+++ b/main.cpp	Wed May 12 10:09:04 2021 +0000
@@ -13,16 +13,12 @@
     /*control codes*/
       wait_ms(2000);   /* keep FPGA in reset for 5s, to let motor stop*/
       enbale_fpga();   /* enable FPGA */ 
-      wait_ms(10);
-      i2c.i2c_window_open();  /*send password 0xd0d0*/
+      wait_ms(45);      
+      i2c.i2c_config_mode_entry();  /*send password 0xd0d0*/
       wait_ms(1);
       i2c.i2c_clear_spd_ctrl();
       wait_ms(1);
-      i2c.i2c_set_input_mode(0x4);
-      wait_ms(1);
-      i2c.i2c_set_open_loop_duty(0xffff);
-      wait_ms(1);
-      i2c.i2c_set_comm_i_thres(15,1);
+      i2c.i2c_set_comm_i_thres(0x0fff,1);  //note, 0fff is -1 signed
       wait_ms(1);
       i2c.i2c_set_comm_di_thres(0,1);
       wait_ms(1);
@@ -58,7 +54,11 @@
       wait_ms(1);
       i2c.i2c_set_ehp_reg_gain(0);
       wait_ms(1);
-      led4 = i2c.i2c_motor_start();  /*send password 0xcafe*/
+      i2c.i2c_skip_app_copy();
+      wait_ms(1);
+      led4 = i2c.i2c_soft_reset();  /*send password 0xcafe*/
+      wait_ms(40);
+      i2c.i2c_set_open_loop_duty(0xffff);
     
     /*enter infinite loop, motor should be running*/
     while (1) {}