PWM based motor driver added from other project
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file StepperDrv8833.hpp
|
||||
* @author Gustice
|
||||
* @brief Software-driver for Stepper driver DRV8833
|
||||
* @details https://www.ti.com/lit/ds/symlink/drv8833.pdf?ts=1726872460958&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252Fde-de%252FDRV8833
|
||||
*
|
||||
* @copyright Copyright (c) 2024
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "stepperDrv.hpp"
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
class StepperDriverDrv8833 : public StepperDriver {
|
||||
public:
|
||||
struct Pins {
|
||||
ledc_timer_t timer;
|
||||
std::array<ledc_channel_t, 4> channels;
|
||||
std::array<gpio_num_t, 4> pins;
|
||||
};
|
||||
|
||||
StepperDriverDrv8833(Pins pins, int resolution);
|
||||
StepCplx fullStep(int8_t cnt) override;
|
||||
StepCplx step(int8_t cnt) override;
|
||||
StepCplx setPos(uint8_t pos) override;
|
||||
uint8_t getSubPos() {
|
||||
return _position;
|
||||
}
|
||||
|
||||
private:
|
||||
PwmPort _pwmA1;
|
||||
PwmPort _pwmA2;
|
||||
PwmPort _pwmB1;
|
||||
PwmPort _pwmB2;
|
||||
|
||||
std::vector<uint8_t> _outA1;
|
||||
std::vector<uint8_t> _outA2;
|
||||
std::vector<uint8_t> _outB1;
|
||||
std::vector<uint8_t> _outB2;
|
||||
void setOutput(uint8_t pos) override;
|
||||
};
|
||||
Reference in New Issue
Block a user