-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDRV8834.h
49 lines (45 loc) · 1.62 KB
/
DRV8834.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* DRV8834 - LV Stepper Motor Driver Driver (A4988-compatible - mostly)
* Indexer mode only.
*
* Copyright (C)2015 Laurentiu Badea
*
* This file may be redistributed under the terms of the MIT license.
* A copy of this license has been included with this distribution in the file LICENSE.
*/
#ifndef DRV8834_H
#define DRV8834_H
#include <Arduino.h>
#include "BasicStepperDriver.h"
class DRV8834 : public BasicStepperDriver {
protected:
int m0_pin = PIN_UNCONNECTED;
int m1_pin = PIN_UNCONNECTED;
void init(void);
// tWH(STEP) pulse duration, STEP high, min value (1.9us)
static const int step_high_min = 2;
// tWL(STEP) pulse duration, STEP low, min value (1.9us)
static const int step_low_min = 2;
// tWAKE wakeup time, nSLEEP inactive to STEP (1000us)
static const int wakeup_time = 1000;
// also 200ns between ENBL/DIR/Mx changes and STEP HIGH
// Get max microsteps supported by the device
unsigned getMaxMicrostep() override;
private:
// microstep range (1, 16, 32 etc)
static const unsigned MAX_MICROSTEP = 32;
public:
/*
* Basic connection: only DIR, STEP are connected.
* Microstepping controls should be hardwired.
*/
DRV8834(int steps, int dir_pin, int step_pin);
DRV8834(int steps, int dir_pin, int step_pin, int enable_pin);
/*
* Fully wired. All the necessary control pins for DRV8834 are connected.
*/
DRV8834(int steps, int dir_pin, int step_pin, int m0_pin, int m1_pin);
DRV8834(int steps, int dir_pin, int step_pin, int enable_pin, int m0_pin, int m1_pin);
unsigned setMicrostep(unsigned microsteps);
};
#endif // DRV8834_H