@@ -125,7 +125,7 @@ void delayMicroseconds(unsigned int us)
125125// 2 microseconds) gives delays longer than desired.
126126//delay_us(us);
127127#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
129129
130130// zero delay fix
131131if (!us ) return ; // = 3 cycles, (4 when true)
@@ -135,9 +135,9 @@ void delayMicroseconds(unsigned int us)
135135// delay requested.
136136us *= 6 ; // x6 us, = 7 cycles
137137
138- // account for the time taken in the preceeding commands.
138+ // account for the time taken in the preceding commands.
139139// 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
141141us -= 5 ; //=2 cycles
142142
143143#elif F_CPU >= 20000000L
@@ -157,9 +157,9 @@ void delayMicroseconds(unsigned int us)
157157// delay requested.
158158us = (us << 2 ) + us ; // x5 us, = 7 cycles
159159
160- // account for the time taken in the preceeding commands.
160+ // account for the time taken in the preceding commands.
161161// 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
163163us -= 7 ; // 2 cycles
164164
165165#elif F_CPU >= 16000000L
@@ -174,9 +174,9 @@ void delayMicroseconds(unsigned int us)
174174// delay requested.
175175us <<= 2 ; // x4 us, = 4 cycles
176176
177- // account for the time taken in the preceeding commands.
177+ // account for the time taken in the preceding commands.
178178// 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
180180us -= 5 ; // = 2 cycles,
181181
182182#elif F_CPU >= 12000000L
@@ -191,9 +191,9 @@ void delayMicroseconds(unsigned int us)
191191// delay requested.
192192us = (us << 1 ) + us ; // x3 us, = 5 cycles
193193
194- // account for the time taken in the preceeding commands.
194+ // account for the time taken in the preceding commands.
195195// 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
197197us -= 5 ; //2 cycles
198198
199199#elif F_CPU >= 8000000L
@@ -208,19 +208,19 @@ void delayMicroseconds(unsigned int us)
208208// delay requested.
209209us <<= 1 ; //x2 us, = 2 cycles
210210
211- // account for the time taken in the preceeding commands.
211+ // account for the time taken in the preceding commands.
212212// 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
214214us -= 4 ; // = 2 cycles
215215
216216#else
217217// for the 1 MHz internal clock (default settings for common Atmega microcontrollers)
218218
219219// the overhead of the function calls is 14 (16) cycles
220220if (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)
222222
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)
224224us -= 22 ; // = 2 cycles
225225// the following loop takes 4 microseconds (4 cycles)
226226// per iteration, so execute it us/4 times
0 commit comments