arduino-emulator
All Classes Namespaces Files Functions Enumerations Pages
pins_arduino.h
1 #ifndef Pins_Arduino_h
2 #define Pins_Arduino_h
3 
4 #include <avr/pgmspace.h>
5 
6 #define NUM_DIGITAL_PINS 20
7 #define NUM_ANALOG_INPUTS 6
8 #define analogInputToDigitalPin(p) ((p < 6) ? (p) + 14 : -1)
9 
10 #if defined(__AVR_ATmega8__)
11 #define digitalPinHasPWM(p) ((p) == 9 || (p) == 10 || (p) == 11)
12 #else
13 #define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11)
14 #endif
15 
16 #define PIN_SPI_SS (10)
17 #define PIN_SPI_MOSI (11)
18 #define PIN_SPI_MISO (12)
19 #define PIN_SPI_SCK (13)
20 
21 static const uint8_t SS = PIN_SPI_SS;
22 static const uint8_t MOSI = PIN_SPI_MOSI;
23 static const uint8_t MISO = PIN_SPI_MISO;
24 static const uint8_t SCK = PIN_SPI_SCK;
25 
26 #define PIN_WIRE_SDA (18)
27 #define PIN_WIRE_SCL (19)
28 
29 static const uint8_t SDA = PIN_WIRE_SDA;
30 static const uint8_t SCL = PIN_WIRE_SCL;
31 
32 #define LED_BUILTIN 13
33 
34 #define PIN_A0 (14)
35 #define PIN_A1 (15)
36 #define PIN_A2 (16)
37 #define PIN_A3 (17)
38 #define PIN_A4 (18)
39 #define PIN_A5 (19)
40 #define PIN_A6 (20)
41 #define PIN_A7 (21)
42 
43 static const uint8_t A0 = PIN_A0;
44 static const uint8_t A1 = PIN_A1;
45 static const uint8_t A2 = PIN_A2;
46 static const uint8_t A3 = PIN_A3;
47 static const uint8_t A4 = PIN_A4;
48 static const uint8_t A5 = PIN_A5;
49 static const uint8_t A6 = PIN_A6;
50 static const uint8_t A7 = PIN_A7;
51 
52 #define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
53 #define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1))
54 #define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
55 #define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14)))
56 
57 #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
58 
59 #endif