Skip to content

Commit 16b8f11

Browse files
committed
add FlashStringHelper and portxxxxRegister functions
1 parent e9ff657 commit 16b8f11

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

avr/cores/picocore/Arduino.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,33 @@
1414
#include "constants.h"
1515

1616
#ifdef __cplusplus
17+
class __FlashStringHelper;
18+
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
19+
1720
extern "C"{
1821
#endif
1922

2023
typedef uint8_t byte;
2124

22-
23-
//__attribute(( used, section(".init9") )) int main();
25+
// main in .init9 saves rjmp instruction
2426
__attribute(( section(".init9") )) int main();
2527

2628
void setup();
2729
void loop();
2830

2931
uint32_t millis();
3032

33+
typedef volatile uint8_t* ioregptr;
34+
35+
extern inline ioregptr portOutputRegister(unsigned addr)
36+
{ return (ioregptr) addr; }
37+
38+
extern inline ioregptr portModeRegister(unsigned addr)
39+
{ return (ioregptr) (addr - 1); }
40+
41+
extern inline ioregptr portInputRegister(unsigned addr)
42+
{ return (ioregptr) (addr - 2); }
43+
3144
void badArg(const char*) __attribute((error("")));
3245

3346
#define ASSERT_CONST(pin) \

0 commit comments

Comments
 (0)