aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tk-delay.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/tk-delay.h b/tk-delay.h
index 324077a..e62aa4c 100644
--- a/tk-delay.h
+++ b/tk-delay.h
@@ -23,6 +23,7 @@
#ifdef OWN_DELAY
#include "tk-attiny.h"
#include <util/delay_basic.h>
+#ifdef USE_DELAY_MS
// Having own _delay_ms() saves some bytes AND adds possibility to use variables as input
void _delay_ms(uint16_t n)
{
@@ -37,15 +38,27 @@ void _delay_ms(uint16_t n)
while(n-- > 0) _delay_loop_2(BOGOMIPS);
//#endif
}
+#endif
#ifdef USE_FINE_DELAY
void _delay_zero() {
_delay_loop_2(BOGOMIPS/3);
}
#endif
+#ifdef USE_DELAY_4MS
+void _delay_4ms(uint8_t n) // because it saves a bit of ROM space to do it this way
+{
+ while(n-- > 0) _delay_loop_2(BOGOMIPS*4);
+}
+#endif
#ifdef USE_DELAY_S
void _delay_s() // because it saves a bit of ROM space to do it this way
{
+ #ifdef USE_DELAY_MS
_delay_ms(1000);
+ #endif
+ #ifdef USE_DELAY_4MS
+ _delay_4ms(250);
+ #endif
}
#endif
#else
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.