Browse Source

Added Lohmann's JSON lib

feature/build_system
Maximilian Stiefel 3 years ago
parent
commit
fd6371f586
  1. 27
      hal/stepper.cpp
  2. 17
      include/stepper.h
  3. 25855
      lib/json.hpp
  4. 9
      main.cpp

27
hal/stepper.cpp

@ -1,11 +1,30 @@
#include<include/stepper.h>
#include <thread>
#include <functional>
namespace simon {
namespace stepper {
c_stepper::c_stepper(const settings_t* const stepper_set,
a4988::a4988_settings_t* a4988_set)
: m_set(stepper_set), m_a4988(a4988_set)
c_stepper::c_stepper(const std::string& axis)
: m_a4988(&m_a4988_set)
/* : m_a4988
{
.gpio_en = 17,
.gpio_step = 18,
.gpio_dir = 22,
.gpio_microsteps{
true, true, true
},
m_stepper
{
.gear_reduction = 64.0f,
.steps_per_revolution = 32.0f
}
*/
{
std::thread t1(std::bind(&a4988::c_allegro_4988::run, &m_a4988));
m_a4988.post_move(32768, true, 100);
m_a4988.kill();
t1.join();
}
}
}

17
include/stepper.h

@ -7,18 +7,25 @@ namespace simon {
namespace stepper {
typedef struct {
const float gear_reduction;
const float steps_per_revolution;
float gear_reduction;
float steps_per_revolution;
} settings_t;
class c_stepper
{
public:
c_stepper(const settings_t* const stepper_set,
a4988::a4988_settings_t* a4988_set);
c_stepper(const std::string& axis);
private:
const settings_t* const m_set;
settings_t m_stepper;
a4988::c_allegro_4988 m_a4988;
a4988::a4988_settings_t m_a4988_set = {
.gpio_en = 17,
.gpio_step = 18,
.gpio_dir = 22,
.gpio_microsteps{
true, true, true
}
};
};
} // namespace stepper

25855
lib/json.hpp

File diff suppressed because it is too large

9
main.cpp

@ -1,14 +1,10 @@
#include <iostream>
#include <include/a4988.h>
#include <include/stepper.h>
#include <thread>
#include <functional>
#include <memory>
int main()
{
using namespace simon;
a4988::a4988_settings_t a4988_set{
/* a4988::a4988_settings_t a4988_set{
.gpio_en = 17,
.gpio_step = 18,
.gpio_dir = 22,
@ -20,14 +16,13 @@ int main()
.gear_reduction = 64.0f,
.steps_per_revolution = 32.0f
};
/*
c_allegro_4988 a4988(&a4988_set);
std::thread t1(std::bind(&c_allegro_4988::run, &a4988));
a4988.post_move(32768, true, 100);
a4988.kill();
t1.join();
*/
stepper::c_stepper(&stepper_set, &a4988_set);
stepper::c_stepper("azimuth");
std::cout << "Hello camera" << std::endl;
return 0;
}

Loading…
Cancel
Save