aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring.c
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/wiring.c')
-rw-r--r--cores/arduino/wiring.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c
index f1a14ef..b956f78 100644
--- a/cores/arduino/wiring.c
+++ b/cores/arduino/wiring.c
@@ -105,11 +105,11 @@ unsigned long micros() {
void delay(unsigned long ms)
{
- uint16_t start = (uint16_t)micros();
+ uint32_t start = micros();
while (ms > 0) {
yield();
- if (((uint16_t)micros() - start) >= 1000) {
+ while ( ms > 0 && (micros() - start) >= 1000) {
ms--;
start += 1000;
}
@@ -303,8 +303,6 @@ void init()
// put timer 1 in 8-bit phase correct pwm mode
#if defined(TCCR1A) && defined(WGM10)
sbi(TCCR1A, WGM10);
-#elif defined(TCCR1)
- #warning this needs to be finished
#endif
// set timer 2 prescale factor to 64
@@ -312,8 +310,8 @@ void init()
sbi(TCCR2, CS22);
#elif defined(TCCR2B) && defined(CS22)
sbi(TCCR2B, CS22);
-#else
- #warning Timer 2 not finished (may not be present on this CPU)
+//#else
+ // Timer 2 not finished (may not be present on this CPU)
#endif
// configure timer 2 for phase correct pwm (8-bit)
@@ -321,8 +319,8 @@ void init()
sbi(TCCR2, WGM20);
#elif defined(TCCR2A) && defined(WGM20)
sbi(TCCR2A, WGM20);
-#else
- #warning Timer 2 not finished (may not be present on this CPU)
+//#else
+ // Timer 2 not finished (may not be present on this CPU)
#endif
#if defined(TCCR3B) && defined(CS31) && defined(WGM30)