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