Bavo Van Achte
/
MLX90418_I2C_master
Fork
main.cpp@8:2554218db1e6, 2021-01-26 (annotated)
- Committer:
- wuliqunyy
- Date:
- Tue Jan 26 11:13:25 2021 +0000
- Revision:
- 8:2554218db1e6
- Parent:
- 6:019ab407ac3c
- Child:
- 9:76a0b9f29a2d
typo bug of the start up pulse corrected (<<3 instead of <<2)
Who changed what in which revision?
User | Revision | Line number | New 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 | 8:2554218db1e6 | 19 | led4 = i2c.i2c_set_soft_start_up(1, 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 | } |