Skip to content

Commit ee3ea1b

Browse files
committed
chore: clean up UNUSED usage
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 42e95ab commit ee3ea1b

21 files changed

Lines changed: 94 additions & 84 deletions

File tree

‎cores/arduino/Tone.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,19 @@ void noTone(uint8_t _pin, bool destruct)
141141
#warning "TIMER_TONE or HAL_TIM_MODULE_ENABLED not defined"
142142
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
143143
{
144-
UNUSED(_pin);
145-
UNUSED(frequency);
146-
UNUSED(duration);
144+
(void)_pin;
145+
(void)frequency;
146+
(void)duration;
147147
}
148148

149149
void noTone(uint8_t _pin)
150150
{
151-
UNUSED(_pin);
151+
(void)_pin;
152152
}
153153

154154
void noTone(uint8_t _pin, bool destruct)
155155
{
156-
UNUSED(_pin);
157-
UNUSED(destruct);
156+
(void)_pin;
157+
(void)destruct;
158158
}
159159
#endif /* HAL_TIM_MODULE_ENABLED && TIMER_TONE && !HAL_TIM_MODULE_ONLY*/

‎cores/arduino/WInterrupts.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ void attachInterrupt(pin_size_t interruptNumber, voidFuncPtr callback, PinStatus
6464
callback_function_t _c = callback;
6565
attachInterrupt(interruptNumber, _c, mode);
6666
#else
67-
UNUSED(interruptNumber);
68-
UNUSED(callback);
69-
UNUSED(mode);
67+
(void)interruptNumber;
68+
(void)callback;
69+
(void)mode;
7070
#endif
7171
}
7272

@@ -80,6 +80,6 @@ void detachInterrupt(pin_size_t interruptNumber)
8080
}
8181
stm32_interrupt_disable(port, STM_GPIO_PIN(p));
8282
#else
83-
UNUSED(interruptNumber);
83+
(void)interruptNumber;
8484
#endif
8585
}

‎cores/arduino/wiring_analog.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static inline uint32_t mapResolution(uint32_t value, uint32_t from, uint32_t to)
179179

180180
void analogReference(uint8_t mode)
181181
{
182-
UNUSED(mode);
182+
(void)mode;
183183
}
184184

185185
// Perform the read operation on the selected analog pin.
@@ -194,7 +194,7 @@ int analogRead(pin_size_t pinNumber)
194194
value = mapResolution(value, _internalReadResolution, _readResolution);
195195
}
196196
#else
197-
UNUSED(pinNumber);
197+
(void)pinNumber;
198198
#endif
199199
return value;
200200
}

‎libraries/IWatchdog/src/IWatchdog.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void IWatchdogClass::set(uint32_t timeout, uint32_t window)
116116
LL_IWDG_SetWindow(IWDG, reload);
117117
}
118118
#else
119-
UNUSED(window);
119+
(void)window;
120120
#endif
121121

122122
// Wait for the registers to be updated (IWDG_SR = 0x0000 0000)
@@ -155,7 +155,7 @@ void IWatchdogClass::get(uint32_t *timeout, uint32_t *window)
155155
*window = (uint32_t)((4 << prescaler) * (win + 1) * base);
156156
}
157157
#else
158-
UNUSED(window);
158+
(void)window;
159159
#endif
160160
}
161161
}

‎libraries/Servo/src/stm32/Servo.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,24 +200,24 @@ bool Servo::attached()
200200
Servo::Servo() {}
201201
uint8_t Servo::attach(pin_size_t pin)
202202
{
203-
UNUSED(pin);
203+
(void)pin;
204204
return 0;
205205
}
206206
uint8_t Servo::attach(pin_size_t pin, int min, int max)
207207
{
208-
UNUSED(pin);
209-
UNUSED(min);
210-
UNUSED(max);
208+
(void)pin;
209+
(void)min;
210+
(void)max;
211211
return 0;
212212
}
213213
void Servo::detach() {}
214214
void Servo::write(int value)
215215
{
216-
UNUSED(value);
216+
(void)value;
217217
}
218218
void Servo::writeMicroseconds(int value)
219219
{
220-
UNUSED(value);
220+
(void)value;
221221
}
222222
int Servo::read()
223223
{

‎libraries/SrcWrapper/inc/PinAF_STM32F1.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static inline void pinF1_DisconnectDebug(PinName pin)
192192
__HAL_AFIO_REMAP_SWJ_NOJTAG(); // JTAG-DP Disabled and SW-DP enabled
193193
}
194194
#else
195-
UNUSED(pin);
195+
(void)pin;
196196
#endif /* STM32F1_FORCE_DEBUG */
197197
}
198198

‎libraries/SrcWrapper/inc/backup.h‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ static inline void setBackupRegister(uint32_t index, uint32_t value)
160160
#elif defined(PWR_BKP0R)
161161
LL_PWR_BKP_SetRegister(index, value);
162162
#else
163-
UNUSED(index);
164-
UNUSED(value);
163+
(void)index;
164+
(void)value;
165165
#endif
166166
}
167167

@@ -184,7 +184,7 @@ static inline uint32_t getBackupRegister(uint32_t index)
184184
#elif defined(PWR_BKP0R)
185185
return LL_PWR_BKP_GetRegister(index);
186186
#else
187-
UNUSED(index);
187+
(void)index;
188188
return 0;
189189
#endif
190190
}
@@ -198,9 +198,9 @@ static inline void writeBackupSRAM(uint32_t offset, uint32_t *data, uint32_t len
198198
*(__IO uint32_t *)(BKPSRAM_BASE + (offset + i) * 4) = data[i];
199199
}
200200
#else
201-
UNUSED(offset);
202-
UNUSED(data);
203-
UNUSED(length);
201+
(void)offset;
202+
(void)data;
203+
(void)length;
204204
#endif
205205
}
206206

@@ -213,9 +213,9 @@ static inline void readBackupSRAM(uint32_t offset, uint32_t *data, uint32_t leng
213213
data[i] = *(__IO uint32_t *)(BKPSRAM_BASE + (offset + i) * 4);
214214
}
215215
#else
216-
UNUSED(offset);
217-
UNUSED(data);
218-
UNUSED(length);
216+
(void)offset;
217+
(void)data;
218+
(void)length;
219219
#endif
220220
}
221221

‎libraries/SrcWrapper/inc/lock_resource.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ static inline void hsem_lock(uint32_t semID, uint32_t retry)
201201
}
202202
}
203203
#else
204-
UNUSED(semID);
205-
UNUSED(retry);
204+
(void)semID;
205+
(void)retry;
206206
#endif /* STM32MP1xx || STM32WBxx */
207207
}
208208

@@ -218,7 +218,7 @@ static inline void hsem_unlock(uint32_t semID)
218218
LL_HSEM_ReleaseLock(HSEM, semID, 0);
219219
}
220220
#else
221-
UNUSED(semID);
221+
(void)semID;
222222
#endif /* STM32MP1xx || STM32WBxx */
223223
}
224224

‎libraries/SrcWrapper/inc/pinconfig.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static inline void pin_DisconnectDebug(PinName pin)
2424
#ifdef STM32F1xx
2525
pinF1_DisconnectDebug(pin);
2626
#else
27-
UNUSED(pin);
27+
(void)pin;
2828
#endif /* STM32F1xx */
2929
}
3030

@@ -54,8 +54,8 @@ static inline void pin_PullConfig(GPIO_TypeDef *gpio, uint32_t ll_pin, uint32_t
5454
static inline void pin_SetAFPin(GPIO_TypeDef *gpio, PinName pin, uint32_t afnum)
5555
{
5656
#ifdef STM32F1xx
57-
UNUSED(gpio);
58-
UNUSED(pin);
57+
(void)gpio;
58+
(void)pin;
5959
pin_SetF1AFPin(afnum);
6060
#else
6161
uint32_t ll_pin = STM_LL_GPIO_PIN(pin);

‎libraries/SrcWrapper/inc/stm32_def.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@
7676

7777
#if defined(USE_HALV2_DRIVER)
7878
#include "stm32_hal.h"
79+
80+
/* Define to avoid any backward compatibility issues */
81+
/* but prefer avoid using it, use (void)variable instead */
82+
#ifndef UNUSED
83+
#define UNUSED STM32_UNUSED
84+
#endif /* UNUSED */
7985
#endif /* USE_HALV2_DRIVER */
8086

8187
#ifndef F_CPU

0 commit comments

Comments
 (0)