34
34
/*----------------------------------------------------------------------------
35
35
* Headers
36
36
*----------------------------------------------------------------------------*/
37
-
38
- #include "pins_arduino.h"
37
+ #include "PeripheralPins.h"
39
38
40
39
#ifdef __cplusplus
41
40
extern "C" {
@@ -88,18 +87,27 @@ enum {
88
87
PC13 , //DIO4
89
88
PEND
90
89
};
91
- // Enum defining Arduino style alias for analog pin number --> Ax
90
+
91
+ // This must be a literal with the same value as PEND
92
+ // It is used with preprocessor tests (e.g. #if NUM_DIGITAL_PINS > 3)
93
+ // so an enum will not work.
94
+ #define NUM_DIGITAL_PINS 28
95
+
96
+ // Allow to define Arduino style alias for analog input pin number --> Ax
97
+ // All pins are digital, analog inputs are a subset of digital pins
98
+ // and must be contiguous to be able to loop on each value
99
+ // This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS
100
+ // defined in pin_arduino.h
101
+ // It is used with preprocessor tests (e.g. #if NUM_ANALOG_INPUTS > 3)
102
+ // so an enum will not work.
92
103
// !!!
93
104
// !!! It must be aligned with the number of analog PinName
94
105
// !!! defined in digitalPin[] array in variant.cpp
95
106
// !!!
96
- enum {
97
- A_START_AFTER = D20 , // pin number preceding A0
98
- A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 ,
99
- A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 ,
100
- AEND
101
- };
102
-
107
+ #define NUM_ANALOG_INPUTS 3
108
+ // Define digital pin number of the first analog input (i.e. which digital pin is A0)
109
+ // First analog pin value (A0) must be greater than or equal to NUM_ANALOG_INPUTS
110
+ #define NUM_ANALOG_FIRST 0
103
111
104
112
// Below ADC, DAC and PWM definitions already done in the core
105
113
// Could be redefined here if needed
@@ -117,15 +125,15 @@ enum {
117
125
#define LED_GREEN LED_BUILTIN
118
126
119
127
// On-board user button
120
- //#define USER_BTN Dx
128
+ //#define USER_BTN x
121
129
122
130
// Below SPI and I2C definitions already done in the core
123
- // Could be redefined here if needed
131
+ // Could be redefined here if differs from the default one
124
132
// SPI Definitions
125
- //#define SS PB0 // Default for Arduino connector compatibility
126
- //#define MOSI PA7 // Default for Arduino connector compatibility
127
- //#define MISO PA6 // Default for Arduino connector compatibility
128
- //#define SCK PA5 // Default for Arduino connector compatibility
133
+ //#define PIN_SPI_SS 10 // Default for Arduino connector compatibility
134
+ //#define PIN_SPI_MOSI 11 // Default for Arduino connector compatibility
135
+ //#define PIN_SPI_MISO 12 // Default for Arduino connector compatibility
136
+ //#define PIN_SPI_SCK 13 // Default for Arduino connector compatibility
129
137
130
138
// LORA
131
139
#define RADIO_RESET_PORT PB13
@@ -141,8 +149,8 @@ enum {
141
149
//#define RADIO_DIO_5_PORT PA4
142
150
143
151
// I2C Definitions
144
- #define SDA 14 // Default for Arduino connector compatibility
145
- #define SCL 15 // Default for Arduino connector compatibility
152
+ #define PIN_WIRE_SDA PB9 // Default for Arduino connector compatibility
153
+ #define PIN_WIRE_SCL PB8 // Default for Arduino connector compatibility
146
154
147
155
// Timer Definitions
148
156
//Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c
@@ -198,4 +206,4 @@ enum {
198
206
#define SERIAL_PORT_HARDWARE Serial
199
207
#endif
200
208
201
- #endif /* _VARIANT_ARDUINO_STM32_ */
209
+ #endif /* _VARIANT_ARDUINO_STM32_ */
0 commit comments