3434/*----------------------------------------------------------------------------
3535 * Headers
3636 *----------------------------------------------------------------------------*/
37-
38- #include "pins_arduino.h"
37+ #include "PeripheralPins.h"
3938
4039#ifdef __cplusplus
4140extern "C" {
@@ -88,18 +87,27 @@ enum {
8887PC13 ,//DIO4
8988PEND
9089};
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.
92103// !!!
93104// !!! It must be aligned with the number of analog PinName
94105// !!! defined in digitalPin[] array in variant.cpp
95106// !!!
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
103111
104112// Below ADC, DAC and PWM definitions already done in the core
105113// Could be redefined here if needed
@@ -117,15 +125,15 @@ enum {
117125#define LED_GREEN LED_BUILTIN
118126
119127// On-board user button
120- //#define USER_BTNDx
128+ //#define USER_BTNx
121129
122130// Below SPI and I2C definitions already done in the core
123- // Could be redefined here ifneeded
131+ // Could be redefined here ifdiffers from the default one
124132// SPI Definitions
125- //#defineSS PB0 // Default for Arduino connector compatibility
126- //#defineMOSI PA7 // Default for Arduino connector compatibility
127- //#defineMISO PA6 // Default for Arduino connector compatibility
128- //#defineSCK PA5 // Default for Arduino connector compatibility
133+ //#definePIN_SPI_SS 10 // Default for Arduino connector compatibility
134+ //#definePIN_SPI_MOSI 11 // Default for Arduino connector compatibility
135+ //#definePIN_SPI_MISO 12 // Default for Arduino connector compatibility
136+ //#definePIN_SPI_SCK 13 // Default for Arduino connector compatibility
129137
130138// LORA
131139#define RADIO_RESET_PORT PB13
@@ -141,8 +149,8 @@ enum {
141149//#define RADIO_DIO_5_PORT PA4
142150
143151// 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
146154
147155// Timer Definitions
148156//Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c
@@ -198,4 +206,4 @@ enum {
198206#define SERIAL_PORT_HARDWARE Serial
199207#endif
200208
201- #endif /* _VARIANT_ARDUINO_STM32_ */
209+ #endif /* _VARIANT_ARDUINO_STM32_ */