Simon's and Max' camera steering software.
https://stiefel.tech
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
830 B
35 lines
830 B
#ifndef INCLUDED_HAL_STEPPER
|
|
#define INCLUDED_HAL_STEPPER
|
|
|
|
#include <include/a4988.h>
|
|
#include <lib/json.hpp>
|
|
#include <thread>
|
|
|
|
namespace simon {
|
|
namespace stepper {
|
|
|
|
using json = nlohmann::json;
|
|
|
|
typedef struct {
|
|
float gear_reduction;
|
|
float steps_per_revolution;
|
|
bool clockwise;
|
|
} settings_t;
|
|
|
|
class c_stepper
|
|
{
|
|
public:
|
|
c_stepper(const std::string& axis);
|
|
float rotate(const float& degrees);
|
|
private:
|
|
settings_t m_stepper;
|
|
std::unique_ptr<a4988::c_allegro_4988> m_ptr_a4988;
|
|
std::thread m_thread;
|
|
private:
|
|
std::string read_file(const std::string& fname) const;
|
|
void extract_settings(const json& j_set, const std::string& axis);
|
|
};
|
|
} // namespace stepper
|
|
} // namespace simon
|
|
|
|
#endif /*INCLUDED_HAL_STEPPER*/
|
|
|