| 1 |
#ifndef Pins_Arduino_h |
| 2 |
#define Pins_Arduino_h |
| 3 |
|
| 4 |
#include <avr/pgmspace.h> |
| 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 |
#define NUM_DIGITAL_PINS 32 |
| 40 |
#define NUM_ANALOG_INPUTS 8 |
| 41 |
#define analogInputToDigitalPin(p) ((p < NUM_ANALOG_INPUTS) ? (p) + 24 : -1) |
| 42 |
|
| 43 |
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 4 || (p) == 6 || (p) == 7 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15) |
| 44 |
|
| 45 |
static const uint8_t SS = 4; |
| 46 |
static const uint8_t MOSI = 5; |
| 47 |
static const uint8_t MISO = 6; |
| 48 |
static const uint8_t SCK = 7; |
| 49 |
|
| 50 |
static const uint8_t SDA = 17; |
| 51 |
static const uint8_t SCL = 16; |
| 52 |
static const uint8_t LED = 7; |
| 53 |
|
| 54 |
static const uint8_t A0 = 24; |
| 55 |
static const uint8_t A1 = 25; |
| 56 |
static const uint8_t A2 = 26; |
| 57 |
static const uint8_t A3 = 27; |
| 58 |
static const uint8_t A4 = 28; |
| 59 |
static const uint8_t A5 = 29; |
| 60 |
static const uint8_t A6 = 30; |
| 61 |
static const uint8_t A7 = 31; |
| 62 |
|
| 63 |
#define digitalPinToPCICR(p) (((p) >= 0 && (p) < NUM_DIGITAL_PINS) ? (&PCICR) : ((uint8_t *)0)) |
| 64 |
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 1 : (((p) <= 15) ? 3 : (((p) <= 23) ? 2 : 0))) |
| 65 |
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0)))) |
| 66 |
#define digitalPinToPCMSKbit(p) ((p) % 8) |
| 67 |
|
| 68 |
#ifdef ARDUINO_MAIN |
| 69 |
|
| 70 |
#define PA 1 |
| 71 |
#define PB 2 |
| 72 |
#define PC 3 |
| 73 |
#define PD 4 |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
const uint16_t PROGMEM port_to_mode_PGM[] = |
| 79 |
{ |
| 80 |
NOT_A_PORT, |
| 81 |
(uint16_t) &DDRA, |
| 82 |
(uint16_t) &DDRB, |
| 83 |
(uint16_t) &DDRC, |
| 84 |
(uint16_t) &DDRD, |
| 85 |
}; |
| 86 |
|
| 87 |
const uint16_t PROGMEM port_to_output_PGM[] = |
| 88 |
{ |
| 89 |
NOT_A_PORT, |
| 90 |
(uint16_t) &PORTA, |
| 91 |
(uint16_t) &PORTB, |
| 92 |
(uint16_t) &PORTC, |
| 93 |
(uint16_t) &PORTD, |
| 94 |
}; |
| 95 |
|
| 96 |
const uint16_t PROGMEM port_to_input_PGM[] = |
| 97 |
{ |
| 98 |
NOT_A_PORT, |
| 99 |
(uint16_t) &PINA, |
| 100 |
(uint16_t) &PINB, |
| 101 |
(uint16_t) &PINC, |
| 102 |
(uint16_t) &PIND, |
| 103 |
}; |
| 104 |
|
| 105 |
const uint8_t PROGMEM digital_pin_to_port_PGM[] = |
| 106 |
{ |
| 107 |
PB, |
| 108 |
PB, |
| 109 |
PB, |
| 110 |
PB, |
| 111 |
PB, |
| 112 |
PB, |
| 113 |
PB, |
| 114 |
PB, |
| 115 |
PD, |
| 116 |
PD, |
| 117 |
PD, |
| 118 |
PD, |
| 119 |
PD, |
| 120 |
PD, |
| 121 |
PD, |
| 122 |
PD, |
| 123 |
PC, |
| 124 |
PC, |
| 125 |
PC, |
| 126 |
PC, |
| 127 |
PC, |
| 128 |
PC, |
| 129 |
PC, |
| 130 |
PC, |
| 131 |
PA, |
| 132 |
PA, |
| 133 |
PA, |
| 134 |
PA, |
| 135 |
PA, |
| 136 |
PA, |
| 137 |
PA, |
| 138 |
PA |
| 139 |
}; |
| 140 |
|
| 141 |
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = |
| 142 |
{ |
| 143 |
_BV(0), |
| 144 |
_BV(1), |
| 145 |
_BV(2), |
| 146 |
_BV(3), |
| 147 |
_BV(4), |
| 148 |
_BV(5), |
| 149 |
_BV(6), |
| 150 |
_BV(7), |
| 151 |
_BV(0), |
| 152 |
_BV(1), |
| 153 |
_BV(2), |
| 154 |
_BV(3), |
| 155 |
_BV(4), |
| 156 |
_BV(5), |
| 157 |
_BV(6), |
| 158 |
_BV(7), |
| 159 |
_BV(0), |
| 160 |
_BV(1), |
| 161 |
_BV(2), |
| 162 |
_BV(3), |
| 163 |
_BV(4), |
| 164 |
_BV(5), |
| 165 |
_BV(6), |
| 166 |
_BV(7), |
| 167 |
_BV(0), |
| 168 |
_BV(1), |
| 169 |
_BV(2), |
| 170 |
_BV(3), |
| 171 |
_BV(4), |
| 172 |
_BV(5), |
| 173 |
_BV(6), |
| 174 |
_BV(7) |
| 175 |
}; |
| 176 |
|
| 177 |
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = |
| 178 |
{ |
| 179 |
NOT_ON_TIMER, |
| 180 |
NOT_ON_TIMER, |
| 181 |
NOT_ON_TIMER, |
| 182 |
TIMER0A, |
| 183 |
TIMER0B, |
| 184 |
NOT_ON_TIMER, |
| 185 |
TIMER3A, |
| 186 |
TIMER3B, |
| 187 |
NOT_ON_TIMER, |
| 188 |
NOT_ON_TIMER, |
| 189 |
NOT_ON_TIMER, |
| 190 |
NOT_ON_TIMER, |
| 191 |
TIMER1B, |
| 192 |
TIMER1A, |
| 193 |
TIMER2B, |
| 194 |
TIMER2A, |
| 195 |
NOT_ON_TIMER, |
| 196 |
NOT_ON_TIMER, |
| 197 |
NOT_ON_TIMER, |
| 198 |
NOT_ON_TIMER, |
| 199 |
NOT_ON_TIMER, |
| 200 |
NOT_ON_TIMER, |
| 201 |
NOT_ON_TIMER, |
| 202 |
NOT_ON_TIMER, |
| 203 |
NOT_ON_TIMER, |
| 204 |
NOT_ON_TIMER, |
| 205 |
NOT_ON_TIMER, |
| 206 |
NOT_ON_TIMER, |
| 207 |
NOT_ON_TIMER, |
| 208 |
NOT_ON_TIMER, |
| 209 |
NOT_ON_TIMER, |
| 210 |
NOT_ON_TIMER |
| 211 |
}; |
| 212 |
|
| 213 |
#endif |
| 214 |
|
| 215 |
#endif |
| 216 |
|