|
1 | 1 | /*
|
2 |
| - esp8266_waveform - General purpose waveform generation and stepper motor |
3 |
| - control, supporting outputs on all pins in parallel. |
| 2 | + esp8266_waveform - General purpose waveform generation and control, |
| 3 | + supporting outputs on all pins in parallel. |
4 | 4 |
|
5 | 5 | Copyright (c) 2018 Earle F. Philhower, III. All rights reserved.
|
6 | 6 |
|
7 | 7 | The core idea is to have a programmable waveform generator with a unique
|
8 | 8 | high and low period (defined in microseconds). TIMER1 is set to 1-shot
|
9 | 9 | mode and is always loaded with the time until the next edge of any live
|
10 |
| - waveforms or Stepper motors. |
| 10 | + waveforms. |
11 | 11 |
|
12 |
| - Up to one waveform generator or stepper driver per pin supported. |
| 12 | + Up to one waveform generator per pin supported. |
13 | 13 |
|
14 | 14 | Each waveform generator is synchronized to the ESP cycle counter, not the
|
15 | 15 | timer. This allows for removing interrupt jitter and delay as the counter
|
16 | 16 | always increments once per 80MHz clock. Changes to a waveform are
|
17 |
| - contiguous and only take effect on the next low->high waveform transition, |
| 17 | + contiguous and only take effect on the next waveform transition, |
18 | 18 | allowing for smooth transitions.
|
19 | 19 |
|
20 | 20 | This replaces older tone(), analogWrite(), and the Servo classes.
|
21 | 21 |
|
22 |
| - The stepper driver supports a constant jerk (da/dt, in ticks/sec^3) to |
23 |
| - produce a smooth acceleration curve and as well as a constant initial |
24 |
| - acceleration and velocity and number of pulses. |
25 |
| -
|
26 |
| - The stepper driver can also force all steppers to wait for completion |
27 |
| - by the use of a SYNC option (i.e. when completing a move where the X and |
28 |
| - Y need to hit at one point before moving to the next X and Y). |
29 |
| -
|
30 |
| - The user application is responsible for actually calculating the proper |
31 |
| - motion profiles (a general-purpose S-curve planner is left as an exercise |
32 |
| - for the reader). |
33 |
| -
|
34 |
| - The steppers should be wired using an A4988 or DRV8825 controller and |
35 |
| - with a single, shared direction pin. |
36 |
| -
|
37 | 22 | Everywhere in the code where "cycles" is used, it means ESP.getCycleTime()
|
38 | 23 | cycles, not TIMER1 cycles (which may be 2 CPU clocks @ 160MHz).
|
39 | 24 |
|
@@ -76,7 +61,7 @@ int stopWaveform(uint8_t pin);
|
76 | 61 | // to determine whether or not to perform an operation.
|
77 | 62 | // Pass in NULL to disable the callback and, if no other waveforms being
|
78 | 63 | // generated, stop the timer as well.
|
79 |
| -// Make sure the CBN function has the ICACHE_RAM_ATTR decorator. |
| 64 | +// Make sure the CB function has the ICACHE_RAM_ATTR decorator. |
80 | 65 | void setTimer1Callback(uint32_t (*fn)());
|
81 | 66 |
|
82 | 67 | #ifdef __cplusplus
|
|
0 commit comments