@@ -279,7 +279,7 @@ static int8_t toneBegin(uint8_t _pin)
279
279
280
280
void tone (uint8_t _pin, unsigned int frequency, unsigned long duration)
281
281
{
282
- uint8_t prescalarbits = 0b001 ;
282
+ uint8_t prescalarbits = 0x01 ;
283
283
long toggle_count = 0 ;
284
284
uint32_t ocr = 0 ;
285
285
int8_t _timer;
@@ -295,38 +295,38 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
295
295
if (_timer == 0 || _timer == 2 )
296
296
{
297
297
ocr = F_CPU / frequency / 2 - 1 ;
298
- prescalarbits = 0b001 ; // ck/1: same for both timers
298
+ prescalarbits = 0x01 ; // ck/1: same for both timers
299
299
if (ocr > 255 )
300
300
{
301
301
ocr = F_CPU / frequency / 2 / 8 - 1 ;
302
- prescalarbits = 0b010 ; // ck/8: same for both timers
302
+ prescalarbits = 0x02 ; // ck/8: same for both timers
303
303
304
304
if (_timer == TIMER_WITH_FULL_PRESCALER && ocr > 255 )
305
305
{
306
306
ocr = F_CPU / frequency / 2 / 32 - 1 ;
307
- prescalarbits = 0b011 ;
307
+ prescalarbits = 0x03 ;
308
308
}
309
309
310
310
if (ocr > 255 )
311
311
{
312
312
ocr = F_CPU / frequency / 2 / 64 - 1 ;
313
- prescalarbits = _timer != TIMER_WITH_FULL_PRESCALER ? 0b011 : 0b100 ;
313
+ prescalarbits = _timer != TIMER_WITH_FULL_PRESCALER ? 0x03 : 0x04 ;
314
314
315
315
if (_timer == TIMER_WITH_FULL_PRESCALER && ocr > 255 )
316
316
{
317
317
ocr = F_CPU / frequency / 2 / 128 - 1 ;
318
- prescalarbits = 0b101 ;
318
+ prescalarbits = 0x05 ;
319
319
}
320
320
321
321
if (ocr > 255 )
322
322
{
323
323
ocr = F_CPU / frequency / 2 / 256 - 1 ;
324
- prescalarbits = _timer != TIMER_WITH_FULL_PRESCALER ? 0b100 : 0b110 ;
324
+ prescalarbits = _timer != TIMER_WITH_FULL_PRESCALER ? 0x04 : 0x06 ;
325
325
if (ocr > 255 )
326
326
{
327
327
// Can't do any better than /1024
328
328
ocr = F_CPU / frequency / 2 / 1024 - 1 ;
329
- prescalarbits = _timer != TIMER_WITH_FULL_PRESCALER ? 0b101 : 0b111 ;
329
+ prescalarbits = _timer != TIMER_WITH_FULL_PRESCALER ? 0x05 : 0x07 ;
330
330
}
331
331
}
332
332
}
@@ -335,13 +335,13 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
335
335
#if defined(TCCR0B)
336
336
if (_timer == 0 )
337
337
{
338
- TCCR0B = (TCCR0B & 0b11111000 ) | prescalarbits;
338
+ TCCR0B = (TCCR0B & 0xf8 ) | prescalarbits;
339
339
}
340
340
else
341
341
#endif
342
342
#if defined(TCCR2B)
343
343
{
344
- TCCR2B = (TCCR2B & 0b11111000 ) | prescalarbits;
344
+ TCCR2B = (TCCR2B & 0xf8 ) | prescalarbits;
345
345
}
346
346
#else
347
347
{
@@ -354,30 +354,30 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
354
354
// two choices for the 16 bit timers: ck/1 or ck/64
355
355
ocr = F_CPU / frequency / 2 - 1 ;
356
356
357
- prescalarbits = 0b001 ;
357
+ prescalarbits = 0x01 ;
358
358
if (ocr > 0xffff )
359
359
{
360
360
ocr = F_CPU / frequency / 2 / 64 - 1 ;
361
- prescalarbits = 0b011 ;
361
+ prescalarbits = 0x03 ;
362
362
}
363
363
364
364
if (_timer == 1 )
365
365
{
366
366
#if defined(TCCR1B)
367
- TCCR1B = (TCCR1B & 0b11111000 ) | prescalarbits;
367
+ TCCR1B = (TCCR1B & 0xf8 ) | prescalarbits;
368
368
#endif
369
369
}
370
370
#if defined(TCCR3B)
371
371
else if (_timer == 3 )
372
- TCCR3B = (TCCR3B & 0b11111000 ) | prescalarbits;
372
+ TCCR3B = (TCCR3B & 0xf8 ) | prescalarbits;
373
373
#endif
374
374
#if defined(TCCR4B)
375
375
else if (_timer == 4 )
376
- TCCR4B = (TCCR4B & 0b11111000 ) | prescalarbits;
376
+ TCCR4B = (TCCR4B & 0xf8 ) | prescalarbits;
377
377
#endif
378
378
#if defined(TCCR5B)
379
379
else if (_timer == 5 )
380
- TCCR5B = (TCCR5B & 0b11111000 ) | prescalarbits;
380
+ TCCR5B = (TCCR5B & 0xf8 ) | prescalarbits;
381
381
#endif
382
382
383
383
}
@@ -486,7 +486,7 @@ void disableTimer(uint8_t _timer)
486
486
TCCR2A = (1 << WGM20);
487
487
#endif
488
488
#if defined(TCCR2B) && defined(CS22)
489
- TCCR2B = (TCCR2B & 0b11111000 ) | (1 << CS22);
489
+ TCCR2B = (TCCR2B & 0xf8 ) | (1 << CS22);
490
490
#endif
491
491
#if defined(OCR2A)
492
492
OCR2A = 0 ;
0 commit comments