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.
Dependencies: mbed mbed-rtos X_NUCLEO_IHM02A1
STEPPER.cpp
- Committer:
- hagenrap
- Date:
- 2019-05-05
- Revision:
- 35:758191d5c6e1
- Parent:
- STEPPER_INIT.cpp@ 34:0dee9a606869
- Child:
- 36:ba2e7eddbafa
File content as of revision 35:758191d5c6e1:
#include "SETUP.h"
/* --------------------------- Variables ------------------------------------ */
extern L6470B **motors2;
extern L6470 **motors;
/* ---------------------------- END ----------------------------------------- */
/* -------------------------- Leerlauf -------------------------------------- */
void Stepper_1_Leerlauf()
{
motors[0]->hard_hiz();
motors[0]->wait_while_active();
}
void Stepper_2_Leerlauf()
{
motors[1]->hard_hiz();
motors[1]->wait_while_active();
}
void Stepper_3_Leerlauf()
{
motors2[0]->hard_hiz();
motors2[0]->wait_while_active();
}
void Stepper_4_Leerlauf()
{
motors2[1]->hard_hiz();
motors2[1]->wait_while_active();
}
/* ---------------------------- END ----------------------------------------- */
/* ---------------------- Setzte Home Position ------------------------------ */
void Stepper_1_SetHome()
{
motors[0]->set_home();
motors[0]->wait_while_active();
}
void Stepper_2_SetHome()
{
motors[1]->set_home();
motors[1]->wait_while_active();
}
void Stepper_3_SetHome()
{
motors2[0]->set_home();
motors2[0]->wait_while_active();
}
void Stepper_4_SetHome()
{
motors2[1]->set_home();
motors2[1]->wait_while_active();
}
/* ---------------------------- END ----------------------------------------- */
/* -------- Setting the current position to be the marked position ---------- */
void Stepper_1_MarkPos()
{
motors[0]->set_mark();
motors[0]->wait_while_active();
}
void Stepper_2_MarkPos()
{
motors[1]->set_mark();
motors[1]->wait_while_active();
}
void Stepper_3_MarkPos()
{
motors2[0]->set_mark();
motors2[0]->wait_while_active();
}
void Stepper_4_MarkPos()
{
motors2[1]->set_mark();
motors2[1]->wait_while_active();
}
/* ---------------------------- END ----------------------------------------- */
/* ------------------------ Get Current Position ---------------------------- */
int Stepper_1_GetPosition()
{
return motors[0]->get_position();
}
int Stepper_2_GetPosition()
{
return motors[1]->get_position();
}
int Stepper_3_GetPosition()
{
return motors2[0]->get_position();
}
int Stepper_4_GetPosition()
{
return motors2[1]->get_position();
}
/* ---------------------------- END ----------------------------------------- */
/* ---------------------- Get Marked Position ------------------------------- */
/*
int Stepper_1_GetMark()
{
return motors[0]->get_mark();
}
int Stepper_2_GetMark()
{
return motors[1]->get_mark();
}
int Stepper_3_GetMark()
{
return motors2[0]->get_mark();
}
int Stepper_4_GetMark()
{
return motors2[1]->get_mark();
}
*/
/* ---------------------------- END ----------------------------------------- */
/* ------------------ Going to a specified position ------------------------- */
void Stepper_1_GoTo(signed int position)
{
motors[0]->go_to(position);
motors[0]->wait_while_active();
}
void Stepper_2_GoTo(signed int position)
{
motors[1]->go_to(position);
motors[1]->wait_while_active();
}
void Stepper_3_GoTo(signed int position)
{
motors2[0]->go_to(position);
motors2[0]->wait_while_active();
}
void Stepper_4_GoTo(signed int position)
{
motors2[1]->go_to(position);
motors2[1]->wait_while_active();
}
/* ---------------------------- END ----------------------------------------- */
/* ------------------------- Go to Home ------------------------------------- */
void Stepper_1_GoHome()
{
motors[0]->go_home();
motors[0]->wait_while_active();
}
void Stepper_2_GoHome()
{
motors[1]->go_home();
motors[1]->wait_while_active();
}
void Stepper_3_GoHome()
{
motors2[0]->go_home();
motors2[0]->wait_while_active();
}
void Stepper_4_GoHome()
{
motors[1]->go_home();
motors[1]->wait_while_active();
}
/* ---------------------------- END ----------------------------------------- */
/* ----------------------------- Go to Mark --------------------------------- */
void Stepper_1_GoMark()
{
motors[0]->go_mark();
motors[0]->wait_while_active();
}
void Stepper_2_GoMark()
{
motors[1]->go_mark();
motors[1]->wait_while_active();
}
void Stepper_3_GoMark()
{
motors2[0]->go_mark();
motors2[0]->wait_while_active();
}
void Stepper_4_GoMark()
{
motors2[1]->go_mark();
motors2[1]->wait_while_active();
}
/* ---------------------------- END ----------------------------------------- */