File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
libraries/Servo/src/esp8266 Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,8 @@ struct ServoTimer0
126126
127127#if !defined (SERVO_EXCLUDE_TIMER1)
128128
129+ #define TIMER1_TICKS_PER_US (APB_CLK_FREQ / 1000000L )
130+
129131struct ServoTimer1
130132{
131133public:
@@ -137,11 +139,11 @@ struct ServoTimer1
137139
138140 uint32_t usToTicks (uint32_t us) const
139141 {
140- return (clockCyclesPerMicrosecond () / 16 * us); // converts microseconds to tick
142+ return (TIMER1_TICKS_PER_US / 16 * us); // converts microseconds to tick
141143 }
142144 uint32_t ticksToUs (uint32_t ticks) const
143145 {
144- return (ticks / clockCyclesPerMicrosecond () * 16 ); // converts from ticks back to microseconds
146+ return (ticks / TIMER1_TICKS_PER_US * 16 ); // converts from ticks back to microseconds
145147 }
146148
147149 void InitInterrupt (timercallback handler)
You can’t perform that action at this time.
0 commit comments