Skip to content

Commit def569f

Browse files
committed
Clean variants files
- Common definitions are moved to pins_arduino_var.h. They could be redefined in variant.h if needed. - Removed *UART_EMUL* definitions as it need to be reworked in SoftwareSerial library. - Pin number over D15 replaced by pin name (more relevant) - Fixed some typos Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 5439291 commit def569f

File tree

22 files changed

+216
-611
lines changed

22 files changed

+216
-611
lines changed

Diff for: cores/arduino/pins_arduino_var.h

+48
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,54 @@ uint32_t pinNametoDigitalPin(PinName p);
100100
(digitalPinFirstOccurence(p) == PIN_SERIAL_TX))
101101
#endif
102102

103+
// Default Definitions, could be redefined in variant.h
104+
#ifndef ADC_RESOLUTION
105+
#define ADC_RESOLUTION 12
106+
#endif
107+
#ifndef DACC_RESOLUTION
108+
#define DACC_RESOLUTION 12
109+
#endif
110+
#ifndef PWM_RESOLUTION
111+
#define PWM_RESOLUTION 8
112+
#endif
113+
#ifndef PWM_FREQUENCY
114+
#define PWM_FREQUENCY 1000
115+
#endif
116+
#ifndef PWM_MAX_DUTY_CYCLE
117+
#define PWM_MAX_DUTY_CYCLE 255
118+
#endif
119+
120+
// Default for Arduino connector compatibility
121+
// SPI Definitions
122+
#ifndef SS
123+
#define SS 10
124+
#endif
125+
#ifndef SS1
126+
#define SS1 4
127+
#endif
128+
#ifndef SS2
129+
#define SS2 7
130+
#endif
131+
#ifndef SS3
132+
#define SS3 8
133+
#endif
134+
#ifndef MOSI
135+
#define MOSI 11
136+
#endif
137+
#ifndef MISO
138+
#define MISO 12
139+
#endif
140+
#ifndef SCK
141+
#define SCK 13
142+
#endif
143+
// I2C Definitions
144+
#ifndef SDA
145+
#define SDA 14
146+
#endif
147+
#ifndef SCL
148+
#define SCL 15
149+
#endif
150+
103151
#ifdef __cplusplus
104152
}
105153
#endif

Diff for: variants/DISCO_F100RB/variant.h

+20-30
Original file line numberDiff line numberDiff line change
@@ -112,42 +112,32 @@ enum {
112112
AEND
113113
};
114114

115-
//ADC resolution is 12bits
116-
#define ADC_RESOLUTION 12
117-
#define DACC_RESOLUTION 12
118-
119-
//PWR resolution
120-
#define PWM_RESOLUTION 8
121-
#define PWM_FREQUENCY 1000
122-
#define PWM_MAX_DUTY_CYCLE 255
123-
124-
//On-board LED pin number
125-
#define LED_BUILTIN 21
115+
// On-board LED pin number
116+
#define LED_BUILTIN PC9
126117
#define LED_GREEN LED_BUILTIN
127-
#define LED_BLUE 20
118+
#define LED_BLUE PC8
128119

129-
//On-board user button
120+
// On-board user button
130121
#define USER_BTN 5
131122

132-
//SPI definitions
133-
#define SS 43
134-
#define SS1 40
135-
#define SS2 41
136-
#define SS3 42
137-
#define MOSI 46
138-
#define MISO 45
139-
#define SCK 44
140-
141-
//I2C Definitions
142-
#define SDA 38
143-
#define SCL 37
144-
145-
//Timer Definitions
146-
//Do not use timer used by PWM pins when possible. See PinMap_PWM.
123+
// SPI Definitions
124+
#define SS PB12
125+
#define SS1 PB9
126+
#define SS2 PB10
127+
#define SS3 PB11
128+
#define MOSI PB15
129+
#define MISO PB14
130+
#define SCK PB13
131+
132+
// I2C Definitions
133+
#define SDA PB7
134+
#define SCL PB6
135+
136+
// Timer Definitions
137+
// Do not use timer used by PWM pins when possible. See PinMap_PWM.
147138
#define TIMER_TONE TIM15
148-
#define TIMER_UART_EMULATED TIM16
149139

150-
//Do not use basic timer: OC is required
140+
// Do not use basic timer: OC is required
151141
#define TIMER_SERVO TIM17 //TODO: advanced-control timers don't work
152142

153143
// UART Definitions

Diff for: variants/DISCO_F407VG/variant.h

+14-30
Original file line numberDiff line numberDiff line change
@@ -137,49 +137,33 @@ enum {
137137
AEND
138138
};
139139

140-
//ADC resolution is 12bits
141-
#define ADC_RESOLUTION 12
142-
#define DACC_RESOLUTION 12
143-
144-
//PWR resolution
145-
#define PWM_RESOLUTION 8
146-
#define PWM_FREQUENCY 1000
147-
#define PWM_MAX_DUTY_CYCLE 255
148-
149-
//On-board LED pin number
150-
#define LED_BUILTIN 18
140+
// On-board LED pin number
141+
#define LED_BUILTIN PD12
151142
#define LED_GREEN LED_BUILTIN
152-
#define LED_BLUE 58
153-
#define LED_RED 19
154-
#define LED_ORANGE 57
143+
#define LED_BLUE PD15
144+
#define LED_RED PD14
145+
#define LED_ORANGE PD13
155146

156-
//On-board user button
147+
// On-board user button
157148
#define USER_BTN 2
158149

159-
160-
//SPI definitions
161-
#define SS 10
162-
#define SS1 4
150+
// SPI Definitions
163151
#define SS2 14
164-
#define MOSI 44
152+
#define MOSI PA7
165153
#define MISO 5
166-
#define SCK 43
154+
#define SCK PA5
167155

168-
//I2C Definitions
169-
#define SDA 66
170-
#define SCL 26
156+
// I2C Definitions
157+
#define SDA PB7
158+
#define SCL PB8
171159

172-
//Timer Definitions
173-
//Do not use timer used by PWM pin. See PinMap_PWM.
160+
// Timer Definitions
161+
// Do not use timer used by PWM pin. See PinMap_PWM.
174162
#define TIMER_TONE TIM6
175163
#define TIMER_SERVO TIM7
176-
#define TIMER_UART_EMULATED TIM6
177164

178165
// UART Definitions
179166
#define SERIAL_UART_INSTANCE 2 //Connected to ST-Link
180-
// UART Emulation
181-
#define UART_EMUL_RX PE_9
182-
#define UART_EMUL_TX PE_11
183167

184168
// Default pin used for 'Serial' instance (ex: ST-Link)
185169
// Mandatory for Firmata

Diff for: variants/DISCO_F746NG/variant.h

+6-30
Original file line numberDiff line numberDiff line change
@@ -69,42 +69,18 @@ enum {
6969
AEND
7070
};
7171

72-
//ADC resolution is 12bits
73-
#define ADC_RESOLUTION 12
74-
#define DACC_RESOLUTION 12
75-
76-
//PWR resolution
77-
#define PWM_RESOLUTION 8
78-
#define PWM_FREQUENCY 1000
79-
#define PWM_MAX_DUTY_CYCLE 255
80-
81-
//On-board LED pin number
72+
// On-board LED pin number
8273
#define LED_BUILTIN 13
8374
#define LED_GREEN LED_BUILTIN
8475

85-
//On-board user button
86-
#define USER_BTN 22
87-
88-
89-
//SPI definitions
90-
#define SS 10
91-
#define SS1 4
92-
#define SS2 7
93-
#define SS3 8
94-
#define MOSI 11
95-
#define MISO 12
96-
#define SCK 13
97-
98-
//I2C Definitions
99-
#define SDA 14
100-
#define SCL 15
76+
// On-board user button
77+
#define USER_BTN PI11
10178

102-
//Timer Definitions
103-
//Do not use timer used by PWM pins when possible. See PinMap_PWM.
79+
// Timer Definitions
80+
// Do not use timer used by PWM pins when possible. See PinMap_PWM.
10481
#define TIMER_TONE TIM6
105-
#define TIMER_UART_EMULATED TIM7
10682

107-
//Do not use basic timer: OC is required
83+
// Do not use basic timer: OC is required
10884
#define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work
10985

11086
// UART Definitions

Diff for: variants/DISCO_L072CZ_LRWAN1/variant.h

+5-28
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,7 @@ enum {
7979
AEND
8080
};
8181

82-
//ADC resolution is 12bits
83-
#define ADC_RESOLUTION 12
84-
#define DACC_RESOLUTION 12
85-
86-
//PWR resolution
87-
#define PWM_RESOLUTION 8
88-
#define PWM_FREQUENCY 1000
89-
#define PWM_MAX_DUTY_CYCLE 255
90-
91-
//On-board LED pin number
82+
// On-board LED pin number
9283
#define LED_BUILTIN PA5
9384
#define LED_LD2 LED_BUILTIN
9485
#define LED_GREEN2 LED_BUILTIN
@@ -99,28 +90,14 @@ enum {
9990
#define LED_RED 5
10091
#define LED_LD4 LED_RED
10192

102-
//On-board user button
93+
// On-board user button
10394
#define USER_BTN 6
10495

105-
106-
//SPI definitions
107-
#define SS 10
108-
#define SS1 4
109-
#define SS2 7
110-
#define SS3 8
111-
#define MOSI 11
112-
#define MISO 12
113-
#define SCK 13
114-
115-
//I2C Definitions
116-
#define SDA 14
117-
#define SCL 15
118-
119-
//Timer Definitions
120-
//Do not use timer used by PWM pins when possible. See PinMap_PWM.
96+
// Timer Definitions
97+
// Do not use timer used by PWM pins when possible. See PinMap_PWM.
12198
#define TIMER_TONE TIM22
12299

123-
//Do not use basic timer: OC is required
100+
// Do not use basic timer: OC is required
124101
#define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work
125102

126103
// UART Definitions

Diff for: variants/DISCO_L475VG_IOT/variant.h

+5-29
Original file line numberDiff line numberDiff line change
@@ -139,45 +139,21 @@ enum {
139139
AEND
140140
};
141141

142-
//ADC resolution is 12bits
143-
#define ADC_RESOLUTION 12
144-
#define DACC_RESOLUTION 12
145-
146-
//PWR resolution
147-
#define PWM_RESOLUTION 8
148-
#define PWM_FREQUENCY 1000
149-
#define PWM_MAX_DUTY_CYCLE 255
150-
151-
//On-board LED pin number
142+
// On-board LED pin number
152143
#define LED_BUILTIN 13
153144
#define LED1 LED_BUILTIN
154145
#define LED2 PB14
155146
#define LED3 PC9
156147
#define LED4 LED3
157148

158-
//On-board user button
149+
// On-board user button
159150
#define USER_BTN PC13
160151

161-
162-
//SPI definitions
163-
#define SS 10
164-
#define SS1 4
165-
#define SS2 7
166-
#define SS3 8
167-
#define MOSI 11
168-
#define MISO 12
169-
#define SCK 13
170-
171-
//I2C Definitions
172-
#define SDA 14
173-
#define SCL 15
174-
175-
//Timer Definitions
176-
//Do not use timer used by PWM pins when possible. See PinMap_PWM.
152+
// Timer Definitions
153+
// Do not use timer used by PWM pins when possible. See PinMap_PWM.
177154
#define TIMER_TONE TIM6
178-
#define TIMER_UART_EMULATED TIM7
179155

180-
//Do not use basic timer: OC is required
156+
// Do not use basic timer: OC is required
181157
#define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work
182158

183159
// UART Definitions

Diff for: variants/NUCLEO_F030R8/variant.h

+6-28
Original file line numberDiff line numberDiff line change
@@ -112,40 +112,18 @@ enum {
112112
AEND
113113
};
114114

115-
//ADC resolution is 12bits
116-
#define ADC_RESOLUTION 12
117-
118-
//PWR resolution
119-
#define PWM_RESOLUTION 8
120-
#define PWM_FREQUENCY 1000
121-
#define PWM_MAX_DUTY_CYCLE 255
122-
123-
//On-board LED pin number
115+
// On-board LED pin number
124116
#define LED_BUILTIN 13
125117
#define LED_GREEN LED_BUILTIN
126118

127-
//On-board user button
128-
#define USER_BTN 24
129-
130-
131-
//SPI definitions
132-
#define SS 10
133-
#define SS1 4
134-
#define SS2 7
135-
#define SS3 8
136-
#define MOSI 11
137-
#define MISO 12
138-
#define SCK 13
139-
140-
//I2C Definitions
141-
#define SDA 14
142-
#define SCL 15
119+
// On-board user button
120+
#define USER_BTN PC13
143121

144-
//Timer Definitions
145-
//Do not use timer used by PWM pins when possible. See PinMap_PWM.
122+
// Timer Definitions
123+
// Do not use timer used by PWM pins when possible. See PinMap_PWM.
146124
#define TIMER_TONE TIM6
147125

148-
//Do not use basic timer: OC is required
126+
// Do not use basic timer: OC is required
149127
#define TIMER_SERVO TIM3 //TODO: advanced-control timers don't work
150128

151129
// UART Definitions

0 commit comments

Comments
 (0)