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.
50 lines
980 B
50 lines
980 B
4 years ago
|
#ifndef INCLUDED_DRIVER_ALLEGRO_4988
|
||
|
#define INCLUDED_DRIVER_ALLEGRO_4988
|
||
|
|
||
|
#define CFG_SAMPLE_RATE_US 5
|
||
|
#define CFG_PERIPHERAL_SRC_PCM 1
|
||
|
#define CFG_DEPRECATED_ARG 0
|
||
|
|
||
|
#include <queue>
|
||
|
|
||
|
namespace simon {
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
const unsigned gpio_en;
|
||
|
const unsigned gpio_step;
|
||
|
const unsigned gpio_dir;
|
||
|
const bool gpio_microsteps[3];
|
||
|
} a4988_settings_t;
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
unsigned steps;
|
||
|
bool dir;
|
||
|
unsigned period_us;
|
||
|
} move_t;
|
||
|
|
||
|
|
||
|
class c_allegro_4988
|
||
|
{
|
||
|
public:
|
||
|
c_allegro_4988(a4988_settings_t* set);
|
||
|
int enable(void);
|
||
|
int disable(void);
|
||
|
void post(move_t move);
|
||
|
void run(void);
|
||
|
private:
|
||
|
a4988_settings_t* m_pset;
|
||
|
bool m_initialized;
|
||
|
std::queue<move_t> m_queue;
|
||
|
unsigned m_pwm_freq;
|
||
|
bool m_alive;
|
||
|
private:
|
||
|
void initialize(void);
|
||
|
int set_pwm_freq(const unsigned pwm_freq);
|
||
|
};
|
||
|
|
||
|
} // namespace simon
|
||
|
|
||
|
#endif /*INCLUDED_DRIVER_ALLEGRO_4988*/
|