@@ -77,15 +77,19 @@ extern "C"
77
77
// Interrupts
78
78
#define digitalPinToInterrupt (P ) ( g_APinDescription[P].ulExtInt )
79
79
80
- // LEDs
80
+ // Digital pins
81
+ #define LED_RED (5u)
82
+ #define LED_GREEN (6u)
83
+ #define LED_BLUE (7u)
84
+ #define LED_BUILTIN (5u) // Introduced in Arduino 1.8, tied to red LED
85
+
81
86
#define PIN_LED_RED (5u)
82
87
#define PIN_LED_GREEN (6u)
83
88
#define PIN_LED_BLUE (7u)
84
89
#define PIN_POWER (8u)
85
90
#define PIN_BUTTON (11u)
86
- /*
87
- * Analog pins
88
- */
91
+
92
+ // Analog pins
89
93
#define PIN_A0 (1ul)
90
94
#define PIN_A1 (1ul)
91
95
#define PIN_A2 (2ul)
@@ -99,26 +103,21 @@ static const uint8_t A3 = PIN_A3;
99
103
static const uint8_t A4 = PIN_A4 ;
100
104
#define ADC_RESOLUTION 10
101
105
102
- // Other pins
106
+ // Internal " pins"
103
107
#define PIN_BATT (ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val)
104
108
#define PIN_1V (ADC_INPUTCTRL_MUXPOS_BANDGAP_Val)
105
109
#define PIN_TEMP (ADC_INPUTCTRL_MUXPOS_TEMP_Val)
106
110
107
111
#define analogReadBattVolts () ((analogRead(PIN_BATT)*4000)/((analogRead(PIN_1V)*100)/11)) // will be e.g. 199 for 1.99V
108
112
#define analogReadVolts (pin ) ((analogRead(pin)*1000)/((analogRead(PIN_1V)*100)/11)) // will be e.g. 199 for 1.99V
109
113
110
- /*
111
- * Serial interfaces
112
- */
113
114
// Serial (SERCOM0)
114
115
#define PIN_SERIAL_RX (3ul)
115
116
#define PIN_SERIAL_TX (4ul)
116
117
#define PAD_SERIAL_TX (UART_TX_PAD_0)
117
118
#define PAD_SERIAL_RX (SERCOM_RX_PAD_1)
118
119
119
- /*
120
- * SPI Interfaces
121
- */
120
+ // SPI
122
121
#define SPI_INTERFACES_COUNT 1
123
122
#define PIN_SPI_MISO (4u)
124
123
#define PIN_SPI_MOSI (1u)
@@ -130,27 +129,20 @@ static const uint8_t A4 = PIN_A4;
130
129
#define PAD_SPI_TX SPI_PAD_0_SCK_1
131
130
#define PAD_SPI_RX SERCOM_RX_PAD_3
132
131
133
- /*
134
132
static const uint8_t SS = PIN_SPI_SS ;
135
133
static const uint8_t MOSI = PIN_SPI_MOSI ;
136
134
static const uint8_t MISO = PIN_SPI_MISO ;
137
135
static const uint8_t SCK = PIN_SPI_SCK ;
138
- */
139
136
140
- /*
141
- * Wire Interfaces
142
- */
137
+ // I2C (wire)
143
138
#define WIRE_INTERFACES_COUNT 1
144
139
145
140
#define PIN_WIRE_SDA (1u)
146
141
#define PIN_WIRE_SCL (2u)
147
142
#define PERIPH_WIRE sercom2
148
143
#define WIRE_IT_HANDLER SERCOM2_Handler
149
144
150
- /*
151
- * USB
152
- */
153
- //#define PIN_USB_HOST_ENABLE (XXul)
145
+ // USB
154
146
#define PIN_USB_DM (9ul)
155
147
#define PIN_USB_DP (10ul)
156
148
0 commit comments