2012-08-25 06:49:08 +00:00
|
|
|
/*
|
|
|
|
* To keep Timer0 for common/timer.c override arduino/wiring.c.
|
|
|
|
*/
|
2014-09-22 01:42:20 +00:00
|
|
|
#define __DELAY_BACKWARD_COMPATIBLE__
|
2012-08-25 06:49:08 +00:00
|
|
|
#include <util/delay.h>
|
|
|
|
#include "common/timer.h"
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
|
|
|
|
unsigned long millis()
|
|
|
|
{
|
2012-09-02 14:47:18 +00:00
|
|
|
return timer_read32();
|
2012-08-25 06:49:08 +00:00
|
|
|
}
|
|
|
|
unsigned long micros()
|
|
|
|
{
|
2012-09-02 14:47:18 +00:00
|
|
|
return timer_read32() * 1000UL;
|
2012-08-25 06:49:08 +00:00
|
|
|
}
|
|
|
|
void delay(unsigned long ms)
|
|
|
|
{
|
|
|
|
_delay_ms(ms);
|
|
|
|
}
|
|
|
|
void delayMicroseconds(unsigned int us)
|
|
|
|
{
|
|
|
|
_delay_us(us);
|
|
|
|
}
|
|
|
|
void init()
|
|
|
|
{
|
|
|
|
timer_init();
|
|
|
|
}
|