1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
#include <Arduino.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
enum {
PB = 2,
PC = 3,
PD = 4,
PE = 5,
PF = 6,
PG = 7,
};
extern "C" {
const uint16_t PROGMEM port_to_mode_PGM[] __attribute__((used)) = {
NOT_A_PORT,
NOT_A_PORT,
(uint16_t)&DDRB,
NOT_A_PORT,
(uint16_t)&DDRD,
(uint16_t)&DDRE,
(uint16_t)&DDRF,
(uint16_t)&DDRG,
NOT_A_PORT,
NOT_A_PORT,
NOT_A_PORT,
NOT_A_PORT,
NOT_A_PORT,
};
const uint16_t PROGMEM port_to_output_PGM[] __attribute__((used)) = {
NOT_A_PORT,
NOT_A_PORT,
(uint16_t)&PORTB,
NOT_A_PORT,
(uint16_t)&PORTD,
(uint16_t)&PORTE,
(uint16_t)&PORTF,
(uint16_t)&PORTG,
NOT_A_PORT,
NOT_A_PORT,
NOT_A_PORT,
NOT_A_PORT,
NOT_A_PORT,
};
const uint16_t PROGMEM port_to_input_PGM[] __attribute__((used)) = {
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
(uint16_t)&PINC,
(uint16_t)&PIND,
(uint16_t)&PINE,
(uint16_t)&PINF,
(uint16_t)&PING,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
};
const uint8_t PROGMEM digital_pin_to_port_PGM[] __attribute__((used)) = {
PE, PE, PE, PE, PE, PE, PE, PE,
PB, PB, PB, PB, PB, PB,
PD, PD,
PG, PG, PG, PG,
PD, PD, PD, PD, PD, PD,
PF, PF, PF, PF, PF, PF, PF, PF,
PB, PB,
};
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] __attribute__((used)) = {
_BV(0), _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), _BV(6), _BV(7),
_BV(5), _BV(4), _BV(0), _BV(2), _BV(3), _BV(1),
_BV(1), _BV(0),
_BV(0), _BV(1), _BV(2), _BV(5),
_BV(2), _BV(3), _BV(4), _BV(5), _BV(6), _BV(7),
_BV(0), _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), _BV(6), _BV(7),
_BV(6), _BV(7),
};
const uint8_t PROGMEM digital_pin_to_timer_PGM[] __attribute__((used)) = {
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, TIMER3A, TIMER3B, TIMER3C, NOT_ON_TIMER, NOT_ON_TIMER,
TIMER1A, TIMER2A, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
NOT_ON_TIMER, NOT_ON_TIMER,
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, TIMER0B,
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
TIMER1B, TIMER1C,
};
}
|