l6470_gimbal_controller_os5
Dependencies: X_NUCLEO_IHM02A1
Revision 1:13fb32a7d8ce, committed 2021-03-30
- Comitter:
- tom_astranis
- Date:
- Tue Mar 30 00:35:56 2021 +0000
- Parent:
- 0:08a64a788d1f
- Commit message:
- Ported to mbed os 5 to use mbed studio
Changed in this revision
--- a/main.cpp Mon Mar 29 23:51:53 2021 +0000
+++ b/main.cpp Tue Mar 30 00:35:56 2021 +0000
@@ -13,10 +13,10 @@
/* Definitions ---------------------------------------------------------------*/
// Max time to run looking for a stall to mark home position
-#define HOME_TIMEOUT_S 5
+#define HOME_TIMEOUT 5s
// LED period / 2
-#define LED_ON_S 0.25
+#define LED_ON_TIME 250ms
/* Variables -----------------------------------------------------------------*/
@@ -142,13 +142,13 @@
// Run at a specified speed (in steps/s).
// Goal is to stall and halt using the IRQ, and set the zero position there.
// Otherwise, time out
- t.attach(&timeout_handler, HOME_TIMEOUT_S);
+ t.attach(&timeout_handler, HOME_TIMEOUT);
// Run "backward" so the farthest "backward" is the zero position.
motors[0]->run(StepperMotor::BWD, 20000);
while(!(flag_set or timeout_set)) {
led1 = !led1;
- wait_ms(LED_ON_S * 1000);
+ ThisThread::sleep_for(LED_ON_TIME);
}
// We're either there or timed out; halt the timeout and hard stop the motor
@@ -170,12 +170,12 @@
printf("Home set. Current Position: %d\r\n", motors[0]->get_position());
/*----- Setting far limit (mark) position - run at constant speed until stall -----*/
- t.attach(&timeout_handler, HOME_TIMEOUT_S);
+ t.attach(&timeout_handler, HOME_TIMEOUT);
motors[0]->run(StepperMotor::FWD, 20000);
while(!(flag_set or timeout_set)) {
led1 = !led1;
- wait_ms(LED_ON_S * 1000);
+ ThisThread::sleep_for(LED_ON_TIME);
}
// We're either there or timed out; halt the timeout and hard stop the motor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Tue Mar 30 00:35:56 2021 +0000 @@ -0,0 +1,1 @@ +https://github.com/armmbed/mbed-os/#bfde5aa1e74802771eaeacfa74789f71677325cb
--- a/mbed.bld Mon Mar 29 23:51:53 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file