Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: i2c_mbed_fpga.h
- Revision:
- 6:019ab407ac3c
- Parent:
- 5:daab0e0e67e2
- Child:
- 9:76a0b9f29a2d
diff -r daab0e0e67e2 -r 019ab407ac3c i2c_mbed_fpga.h
--- a/i2c_mbed_fpga.h	Fri Jan 22 14:06:54 2021 +0000
+++ b/i2c_mbed_fpga.h	Mon Jan 25 13:21:57 2021 +0000
@@ -1,7 +1,12 @@
 #ifndef I2C_MBED_FPGA_H
 #define I2C_MBED_FPGA_H
 
-#define i2c_slave_addr 0x18<<1
+#include "nv_bitfield_map.h"
+#include "nv_defines.h"
+#include "nv_defaults.h"
+
+
+#define I2C_SLAVE_ADDR 0x18<<1
 
 //Class delclarations
 class i2c_mbed_fpga {
@@ -9,16 +14,39 @@
 public:    
     /*constructor*/    
     i2c_mbed_fpga(): i2c_master(p9, p10){
-        i2c_master.frequency(35000);    
+        i2c_master.frequency(35000);
+        nv_positin_val = NV_POSITION_DEFUALT;
+        nv_start_up_val = NV_START_UP_DEFAULT; 
+        nv_wind_brake_val = NV_WIND_BRAKE_DEFAULT;     
     };
-
+    
+    int i2c_word_read(char *word);
     int i2c_word_write(char *word);
-    int i2c_word_read(char *word);
+    int i2c_word_safe_write(char *word);
+    
     int i2c_window_open();
     int i2c_motor_start();
     
+    int i2c_set_position_pulse_width(unsigned int manstisa_2b, unsigned int exponenet_3b);
+    int i2c_set_position_duty(unsigned int duty_2b);
+    int i2c_set_position_maj_vote(unsigned int maj_1b);
+    int i2c_set_position_anti_cog(unsigned int cog_1b);
+    
+    int i2c_set_start_up_pulse_width(unsigned int mantisaa_3b, unsigned int exponent_3b);
+    int i2c_set_start_up_duty(unsigned int duty_2b);
+    int i2c_set_start_up_num_comm(unsigned int comm);
+    int i2c_set_soft_start_up(unsigned int enbale, unsigned int mantisaa_3b, unsigned int exponent_3b, unsigned int step_size, unsigned int num_steps);
+    int i2c_set_high_torque_start_up(unsigned int enbale, unsigned int mantisaa_3b, unsigned int exponent_3b);
+    int i2c_set_single_pulse_start_up(unsigned int enbale, unsigned int mantisaa_3b, unsigned int exponent_3b);
+
+    
 private:
     I2C i2c_master;
+    unsigned int nv_positin_val;
+    unsigned int nv_start_up_val;
+    unsigned int nv_wind_brake_val;
+
+    //Position Detection Task/Functions
 };
 
 
    