mirror of https://github.com/noisymime/Arduino.git
Fixed (improved, at least) millis(), changed printString to take (char *) instead of (unsigned char *) to work with string literals (e.g. printString("hello");) in C++.
This commit is contained in:
parent
7e0183cf41
commit
ddb6120299
|
@ -212,7 +212,7 @@ void printNewline()
|
||||||
printByte('\n');
|
printByte('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
void printString(unsigned char *s)
|
void printString(char *s)
|
||||||
{
|
{
|
||||||
while (*s)
|
while (*s)
|
||||||
printByte(*s++);
|
printByte(*s++);
|
||||||
|
@ -284,7 +284,9 @@ unsigned long millis()
|
||||||
// overflows when it reaches 256. we calculate the total
|
// overflows when it reaches 256. we calculate the total
|
||||||
// number of clock cycles, then divide by the number of clock
|
// number of clock cycles, then divide by the number of clock
|
||||||
// cycles per millisecond.
|
// cycles per millisecond.
|
||||||
return timer0GetOverflowCount() * timer0GetPrescaler() * 256L / (F_CPU / 1000L);
|
//return timer0GetOverflowCount() * timer0GetPrescaler() * 256L / (F_CPU / 1000L);
|
||||||
|
return (unsigned long) timer0GetOverflowCount() * timer0GetPrescaler() * 2UL / (F_CPU / 128000UL);
|
||||||
|
//return (((unsigned long) timer0GetOverflowCount()) / 62UL) * (unsigned long) timer0GetPrescaler();
|
||||||
}
|
}
|
||||||
|
|
||||||
void delay(unsigned long ms)
|
void delay(unsigned long ms)
|
||||||
|
|
Loading…
Reference in New Issue