Skip to content

Commit 717bbb5

Browse files
committed
2 parents d2a44fb + d227d0c commit 717bbb5

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/ArduinoShrink.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
// (c) Ralph Doncaster 2020
22
// ArduinoShrink
33

4-
extern "C" void delay_impl();
5-
// lightweight custom function call abi
6-
__attribute((always_inline))
7-
inline void delay(uint32_t msec)
8-
{
9-
register __uint24 ms asm ("r24") = msec;
10-
asm volatile (
11-
"%~call %x1\n"
12-
: "+r"(ms)
13-
: "i"(delay_impl)
14-
: "r20", "r21" // clobbers
15-
);
16-
}
17-
4+
// Nothing here since ArduinoShrink replaces functions already defined
5+
// in Arduino.h

src/wiring.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66
#include <util/delay.h>
77
#include "as_common.h"
88

9+
extern void delay_impl();
10+
11+
// lightweight asm function call interface
12+
void delay(uint32_t msec)
13+
{
14+
register __uint24 ms asm ("r24") = msec;
15+
asm volatile (
16+
"%~call %x1\n"
17+
: "+r"(ms)
18+
: "i"(delay_impl)
19+
: "r20", "r21" // clobbers
20+
);
21+
}
22+
923
// delays a specified number of microseconds - modified from picoCore
1024
// works for clock frequencies of 4Mhz and up
1125
void delayMicroseconds(uint16_t us)

0 commit comments

Comments
 (0)