Fork

Dependencies:   mbed libscpi

Committer:
wuliqunyy
Date:
Mon Jan 25 13:21:57 2021 +0000
Revision:
6:019ab407ac3c
Parent:
5:daab0e0e67e2
Child:
8:2554218db1e6
Code clean up with I2C class

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wuliqunyy 0:fe3c7dde9771 1 #include "mbed.h"
wuliqunyy 5:daab0e0e67e2 2 #include "main_init.h"
wuliqunyy 6:019ab407ac3c 3 #include "i2c_mbed_fpga.h"
wuliqunyy 0:fe3c7dde9771 4
wuliqunyy 0:fe3c7dde9771 5
wuliqunyy 0:fe3c7dde9771 6 /* Main function */
wuliqunyy 0:fe3c7dde9771 7 int main() {
wuliqunyy 6:019ab407ac3c 8
wuliqunyy 6:019ab407ac3c 9 /*init funcitons*/
wuliqunyy 5:daab0e0e67e2 10 i2c_mbed_fpga i2c;
wuliqunyy 6:019ab407ac3c 11 main_init(); /*reset the FPGA!*/
wuliqunyy 3:557d5725b1bb 12
wuliqunyy 6:019ab407ac3c 13 /*control codes*/
wuliqunyy 6:019ab407ac3c 14 wait_ms(5000); /* keep FPGA in reset for 5s, to let motor stop*/
wuliqunyy 6:019ab407ac3c 15 enbale_fpga(); /* enable FPGA */
wuliqunyy 6:019ab407ac3c 16 led4 = i2c.i2c_window_open(); /*send password 0xd0d0*/
wuliqunyy 6:019ab407ac3c 17 wait_ms(1000);
wuliqunyy 6:019ab407ac3c 18 //i2c.i2c_set_position_pulse_width(3,4); /*unsigned int mantisaa_2b, unsigned int exponent_3b*/
wuliqunyy 6:019ab407ac3c 19 led4 = i2c.i2c_set_soft_start_up(0, 1, 0, 1, 1);
wuliqunyy 6:019ab407ac3c 20 wait_ms(1000);
wuliqunyy 6:019ab407ac3c 21 led4 = i2c.i2c_motor_start(); /*send password 0xcafe*/
wuliqunyy 6:019ab407ac3c 22
wuliqunyy 6:019ab407ac3c 23 /*enter infinite loop, motor should be running*/
wuliqunyy 5:daab0e0e67e2 24 while (1) {}
wuliqunyy 0:fe3c7dde9771 25
wuliqunyy 0:fe3c7dde9771 26 }