Skip to content

Commit b44f249

Browse files
committed
fix issue #8
1 parent 3efe21a commit b44f249

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
@@ -5,6 +5,20 @@
55
#include <util/delay.h>
66
#include "as_common.h"
77

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

0 commit comments

Comments
 (0)