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