@@ -125,7 +125,7 @@ void delayMicroseconds(unsigned int us)
125
125
// 2 microseconds) gives delays longer than desired.
126
126
//delay_us(us);
127
127
#if F_CPU >= 24000000L
128
- // for the 24 MHz clock for the aventurous ones, trying to overclock
128
+ // for the 24 MHz clock for the adventurous ones trying to overclock
129
129
130
130
// zero delay fix
131
131
if (!us ) return ; // = 3 cycles, (4 when true)
@@ -135,9 +135,9 @@ void delayMicroseconds(unsigned int us)
135
135
// delay requested.
136
136
us *= 6 ; // x6 us, = 7 cycles
137
137
138
- // account for the time taken in the preceeding commands.
138
+ // account for the time taken in the preceding commands.
139
139
// we just burned 22 (24) cycles above, remove 5, (5*4=20)
140
- // us is at least 6 so we can substract 5
140
+ // us is at least 6 so we can subtract 5
141
141
us -= 5 ; //=2 cycles
142
142
143
143
#elif F_CPU >= 20000000L
@@ -157,9 +157,9 @@ void delayMicroseconds(unsigned int us)
157
157
// delay requested.
158
158
us = (us << 2 ) + us ; // x5 us, = 7 cycles
159
159
160
- // account for the time taken in the preceeding commands.
160
+ // account for the time taken in the preceding commands.
161
161
// we just burned 26 (28) cycles above, remove 7, (7*4=28)
162
- // us is at least 10 so we can substract 7
162
+ // us is at least 10 so we can subtract 7
163
163
us -= 7 ; // 2 cycles
164
164
165
165
#elif F_CPU >= 16000000L
@@ -174,9 +174,9 @@ void delayMicroseconds(unsigned int us)
174
174
// delay requested.
175
175
us <<= 2 ; // x4 us, = 4 cycles
176
176
177
- // account for the time taken in the preceeding commands.
177
+ // account for the time taken in the preceding commands.
178
178
// we just burned 19 (21) cycles above, remove 5, (5*4=20)
179
- // us is at least 8 so we can substract 5
179
+ // us is at least 8 so we can subtract 5
180
180
us -= 5 ; // = 2 cycles,
181
181
182
182
#elif F_CPU >= 12000000L
@@ -191,9 +191,9 @@ void delayMicroseconds(unsigned int us)
191
191
// delay requested.
192
192
us = (us << 1 ) + us ; // x3 us, = 5 cycles
193
193
194
- // account for the time taken in the preceeding commands.
194
+ // account for the time taken in the preceding commands.
195
195
// we just burned 20 (22) cycles above, remove 5, (5*4=20)
196
- // us is at least 6 so we can substract 5
196
+ // us is at least 6 so we can subtract 5
197
197
us -= 5 ; //2 cycles
198
198
199
199
#elif F_CPU >= 8000000L
@@ -208,19 +208,19 @@ void delayMicroseconds(unsigned int us)
208
208
// delay requested.
209
209
us <<= 1 ; //x2 us, = 2 cycles
210
210
211
- // account for the time taken in the preceeding commands.
211
+ // account for the time taken in the preceding commands.
212
212
// we just burned 17 (19) cycles above, remove 4, (4*4=16)
213
- // us is at least 6 so we can substract 4
213
+ // us is at least 6 so we can subtract 4
214
214
us -= 4 ; // = 2 cycles
215
215
216
216
#else
217
217
// for the 1 MHz internal clock (default settings for common Atmega microcontrollers)
218
218
219
219
// the overhead of the function calls is 14 (16) cycles
220
220
if (us <= 16 ) return ; //= 3 cycles, (4 when true)
221
- if (us <= 25 ) return ; //= 3 cycles, (4 when true), (must be at least 25 if we want to substract 22)
221
+ if (us <= 25 ) return ; //= 3 cycles, (4 when true), (must be at least 25 if we want to subtract 22)
222
222
223
- // compensate for the time taken by the preceeding and next commands (about 22 cycles)
223
+ // compensate for the time taken by the preceding and next commands (about 22 cycles)
224
224
us -= 22 ; // = 2 cycles
225
225
// the following loop takes 4 microseconds (4 cycles)
226
226
// per iteration, so execute it us/4 times
0 commit comments