Fork

Dependencies:   mbed libscpi

Committer:
wuliqunyy
Date:
Fri Feb 26 08:45:13 2021 +0000
Revision:
9:76a0b9f29a2d
Parent:
8:2554218db1e6
Child:
10:a8390614edcc
updated for ganymede14

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 9:76a0b9f29a2d 14 wait_ms(2000); /* keep FPGA in reset for 5s, to let motor stop*/
wuliqunyy 9:76a0b9f29a2d 15 enbale_fpga(); /* enable FPGA */
wuliqunyy 9:76a0b9f29a2d 16 wait_ms(1000);
wuliqunyy 6:019ab407ac3c 17 led4 = i2c.i2c_window_open(); /*send password 0xd0d0*/
wuliqunyy 9:76a0b9f29a2d 18 //wait_ms(1000);
wuliqunyy 6:019ab407ac3c 19 //i2c.i2c_set_position_pulse_width(3,4); /*unsigned int mantisaa_2b, unsigned int exponent_3b*/
wuliqunyy 9:76a0b9f29a2d 20 //wait_ms(1000);
wuliqunyy 9:76a0b9f29a2d 21 //led4 = i2c.i2c_set_soft_start_up(1, 1, 0, 1, 1);
wuliqunyy 9:76a0b9f29a2d 22 wait_ms(1000);
wuliqunyy 9:76a0b9f29a2d 23 i2c.i2c_set_position_anti_cog(1);
wuliqunyy 9:76a0b9f29a2d 24 wait_ms(1000);
wuliqunyy 9:76a0b9f29a2d 25 i2c.i2c_set_loop_mode(0);
wuliqunyy 9:76a0b9f29a2d 26 wait_ms(1000);
wuliqunyy 9:76a0b9f29a2d 27 i2c.i2c_set_open_loop_duty(0x8000);
wuliqunyy 6:019ab407ac3c 28 wait_ms(1000);
wuliqunyy 6:019ab407ac3c 29 led4 = i2c.i2c_motor_start(); /*send password 0xcafe*/
wuliqunyy 6:019ab407ac3c 30
wuliqunyy 6:019ab407ac3c 31 /*enter infinite loop, motor should be running*/
wuliqunyy 5:daab0e0e67e2 32 while (1) {}
wuliqunyy 0:fe3c7dde9771 33
wuliqunyy 0:fe3c7dde9771 34 }