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:
- 10:a8390614edcc
- Parent:
- 9:76a0b9f29a2d
- Child:
- 11:b86aea372744
--- a/i2c_mbed_fpga.cpp Fri Feb 26 08:45:13 2021 +0000
+++ b/i2c_mbed_fpga.cpp Fri Feb 26 10:16:32 2021 +0000
@@ -57,15 +57,23 @@
/** i2c enter key to open I2C window
*/
int i2c_mbed_fpga::i2c_window_open(){
- char i2cKey[4] = {0x13, 0xFA, 0xD0, 0xD0};
- return i2c_word_write(i2cKey);
+ char i2cMessage[4];
+ *(i2cMessage+0) = (char)(NVADDR_NV_TRACEABILITY_0 >> 8)& 0xff;
+ *(i2cMessage+1) = (char)(NVADDR_NV_TRACEABILITY_0 >> 0)& 0xff;
+ *(i2cMessage+2) = (char)(0xD0)& 0xff;
+ *(i2cMessage+3) = (char)(0xD0)& 0xff;
+ return i2c_word_safe_write(i2cMessage);
}
/** i2c enter key to Start the motor
*/
int i2c_mbed_fpga::i2c_motor_start(){
- char i2cKey[4] = {0x13, 0xFA, 0xCA, 0xFE};
- return i2c_word_write(i2cKey);
+ char i2cMessage[4];
+ *(i2cMessage+0) = (char)(NVADDR_NV_TRACEABILITY_0 >> 8)& 0xff;
+ *(i2cMessage+1) = (char)(NVADDR_NV_TRACEABILITY_0 >> 0)& 0xff;
+ *(i2cMessage+2) = (char)(0xCA)& 0xff;
+ *(i2cMessage+3) = (char)(0xFE)& 0xff;
+ return i2c_word_safe_write(i2cMessage);
}
/** i2c to set the Postion Pulse width
@@ -262,15 +270,13 @@
*/
int i2c_mbed_fpga::i2c_set_open_loop_duty(unsigned int duty){
int ack = 0;
- nv_start_up_val = duty;
+ ram_open_duty_val = duty;
char i2cMessage[4];
*(i2cMessage+0) = (char)(0x10)& 0xff;
*(i2cMessage+1) = (char)(0x3e)& 0xff;
- *(i2cMessage+2) = (char)(nv_start_up_val >> 8)& 0xff;
- *(i2cMessage+3) = (char)(nv_start_up_val >> 0)& 0xff;
+ *(i2cMessage+2) = (char)(ram_open_duty_val >> 8)& 0xff;
+ *(i2cMessage+3) = (char)(ram_open_duty_val >> 0)& 0xff;
ack += i2c_word_safe_write(i2cMessage);
-
-
return ack;
}
