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.cpp
- Revision:
- 16:a0bfe33f8a4a
- Parent:
- 15:83bbc18cccbc
--- a/i2c_mbed_fpga.cpp Wed May 12 10:09:04 2021 +0000
+++ b/i2c_mbed_fpga.cpp Fri May 21 12:42:56 2021 +0000
@@ -1,6 +1,6 @@
#include "mbed.h"
#include "i2c_mbed_fpga.h"
-DigitalOut led3(LED3);
+
/** i2c read from slave DUT
* retun 0 on success, otherwise fails
@@ -29,7 +29,7 @@
}
-/** i2c enter key to open I2C window
+/** i2c enter key to open I2C window (for old releases)
*/
//int i2c_mbed_fpga::i2c_window_open(){
// char i2cMessage[3];
@@ -39,7 +39,7 @@
// return i2c_word_write(i2cMessage);
//}
-/** i2c enter key to Start the motor
+/** i2c enter key to Start the motor (for old releases)
*/
//int i2c_mbed_fpga::i2c_motor_start(){
// char i2cMessage[3];
@@ -60,6 +60,24 @@
return i2c_word_write(i2cMessage);
}
+/** i2c enter MLX key to open I2C MLX configuration mode entry
+*/
+int i2c_mbed_fpga::i2c_mlx_mode_entry(){
+ int ack = 0;
+ char i2cMessage[3];
+ *(i2cMessage+0) = (char)(I2C_COMMAND_CONTROL)& 0xff;
+ *(i2cMessage+1) = (char)(0x35)& 0xff;
+ *(i2cMessage+2) = (char)(0x4B)& 0xff;
+ ack += i2c_word_write(i2cMessage);
+ *(i2cMessage+0) = (char)(I2C_COMMAND_KEY)& 0xff;
+ *(i2cMessage+1) = (char)(0x65)& 0xff;
+ *(i2cMessage+2) = (char)(0xA9)& 0xff;
+ ack += i2c_word_write(i2cMessage);
+
+ return ack;
+}
+
+
/** i2c ram start up flag set to skip OTP copy
*/
int i2c_mbed_fpga::i2c_skip_app_copy(){
@@ -449,4 +467,52 @@
return ack;
}
+/** i2c to set the target CLIM during start up
+*/
+int i2c_mbed_fpga::i2c_set_clim_start_up(unsigned int clim){
+ int ack = 0;
+ nv_clim_user_1_val &= ~NV_TARGET_CLIM_USER_PULSES_MASK;
+ nv_clim_user_1_val |= clim << NV_TARGET_CLIM_USER_PULSES_OFFSET;
+ char i2cMessage[3];
+ *(i2cMessage+0) = (char)(I2C_CLIM_USER_1 >> 0)& 0xff;
+ *(i2cMessage+1) = (char)(nv_clim_user_1_val >> 8)& 0xff;
+ *(i2cMessage+2) = (char)(nv_clim_user_1_val >> 0)& 0xff;
+ ack += i2c_word_write(i2cMessage);
+
+ return ack;
+}
+/** i2c to set the target CLIM during brake
+*/
+int i2c_mbed_fpga::i2c_set_clim_brake(unsigned int clim){
+ int ack = 0;
+ nv_clim_user_0_val &= ~NV_TARGET_CLIM_USER_BRAKE_MASK;
+ nv_clim_user_0_val |= clim << NV_TARGET_CLIM_USER_BRAKE_OFFSET;
+ char i2cMessage[3];
+ *(i2cMessage+0) = (char)(I2C_CLIM_USER_0 >> 0)& 0xff;
+ *(i2cMessage+1) = (char)(nv_clim_user_0_val >> 8)& 0xff;
+ *(i2cMessage+2) = (char)(nv_clim_user_0_val >> 0)& 0xff;
+ ack += i2c_word_write(i2cMessage);
+
+ return ack;
+}
+
+/** i2c to set the target CLIM during run time
+*/
+int i2c_mbed_fpga::i2c_set_clim_run_time(unsigned int clim){
+ int ack = 0;
+ nv_clim_user_0_val &= ~NV_TARGET_CLIM_USER_MOTOR_MASK;
+ nv_clim_user_0_val |= clim << NV_TARGET_CLIM_USER_MOTOR_OFFSET;
+ char i2cMessage[3];
+ *(i2cMessage+0) = (char)(I2C_CLIM_USER_0 >> 0)& 0xff;
+ *(i2cMessage+1) = (char)(nv_clim_user_0_val >> 8)& 0xff;
+ *(i2cMessage+2) = (char)(nv_clim_user_0_val >> 0)& 0xff;
+ ack += i2c_word_write(i2cMessage);
+
+ return ack;
+}
+
+
+/** i2c to read I2C_CLIM_CALIB
+*/
+
