Skip to content

Commit 1c12d19

Browse files
fix compiler warings; consistently use const for USB data
1 parent 9c2d833 commit 1c12d19

32 files changed

+130
-172
lines changed

cores/stm32l4/FS.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ int File::available() {
5656
}
5757

5858
int File::read() {
59-
int c;
60-
6159
if (!_file)
6260
return -1;
6361

cores/stm32l4/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CFLAGS = -mcpu=cortex-m4 -mthumb -c -g3 -Os $(WARNINGS) -std=gnu11 -ffunction-
99
CXXFLAGS = -mcpu=cortex-m4 -mthumb -c -g3 -Os $(WARNINGS) -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD $(EXTRAS) $(DEFINES) $(INCLUDES)
1010
ASFLAGS = -c -g -x assembler-with-cpp $(EXTRAS) $(DEFINES) $(INCLUDES)
1111
LDFLAGS = -L../../variants/dragonfly -Os -Wl,--gc-sections -save-temps $(EXTRAS) -T../../variants/dragonfly/linker_scripts/flash.ld -specs=nano.specs --specs=nosys.specs -mcpu=cortex-m4 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align
12-
WARNINGS = -w
12+
WARNINGS = -Wall -Wextra -Wno-unused-parameter
1313
EXTRAS = -DSTM32L476xx -D__FPU_PRESENT=1 -march=armv7e-m -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mabi=aapcs -mslow-flash-data
1414
DEFINES = -DF_CPU=80000000L -DARDUINO=10606 -D_ARDUINO_STM32L4_DRAGONFLY -DARDUINO_ARCH_STM32L4
1515
INCLUDES = -I../../system/libstm32l4_dragonfly/CMSIS/Include -I../../system/libstm32l4_dragonfly/CMSIS/Device/ST/STM32L4xx/Include -I../../system/libstm32l4_dragonfly/USB/HAL/Inc -I../../system/libstm32l4_dragonfly/USB/Core/Inc -I../../system/libstm32l4_dragonfly/USB/Class/CDC/Inc -I../../system/libstm32l4_dragonfly/USB/Class/MSC/Inc -I../../system/libstm32l4_dragonfly/USB -I../../system/libstm32l4_dragonfly/ -I../../variants/dragonfly -I../../libraries/SPI/ -I../../libraries/Wire/ -I../../libraries/Servo/src/ -I.

cores/stm32l4/WInterrupts.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
5151
*/
5252
void detachInterrupt(uint32_t pin)
5353
{
54-
unsigned long instance;
55-
5654
if (!(g_APinDescription[pin].attr & PIN_ATTR_EXTI))
5755
return;
5856

cores/stm32l4/wiring.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ void UsageFault_Handler(void)
5353

5454
void init( void )
5555
{
56-
uint32_t pin;
57-
5856
stm32l4_system_configure(F_CPU, F_CPU, F_CPU/2, F_CPU/2);
5957

6058
armv7m_svcall_initialize();

cores/stm32l4/wiring_analog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ static const unsigned int stm32l4_pwm_xlate_instance[PWM_INSTANCE_COUNT] = {
3737
static int _readResolution = 10;
3838
static int _writeResolution = 8;
3939

40-
static int _writeFrequency[PWM_INSTANCE_COUNT];
41-
static int _writeRange[PWM_INSTANCE_COUNT];
40+
static uint32_t _writeFrequency[PWM_INSTANCE_COUNT];
41+
static uint32_t _writeRange[PWM_INSTANCE_COUNT];
4242

4343
static uint8_t _writeCalibrate = 3;
4444

cores/stm32l4/wiring_pulse.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
* before the start of the pulse. */
2525
uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout)
2626
{
27-
if ( g_APinDescription[pin].GPIO == NULL )
28-
{
29-
return ;
30-
}
27+
if (g_APinDescription[pin].GPIO == NULL)
28+
{
29+
return 0;
30+
}
3131

3232
// cache the port and bit of the pin in order to speed up the
3333
// pulse width measuring loop and achieve finer resolution. calling

libraries/SPI/SPI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ uint16_t SPIClass::_exchange16Select(struct _stm32l4_spi_t *spi, uint16_t data)
311311
spi_class->_exchangeRoutine = stm32l4_spi_exchange;
312312
spi_class->_exchange8Routine = stm32l4_spi_exchange8;
313313
spi_class->_exchange16Routine = stm32l4_spi_exchange16;
314+
315+
stm32l4_spi_select(spi, settings._control);
314316

315317
return (*spi_class->_exchange16Routine)(spi, data);
316318
}

libraries/Servo/src/Servo.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ static void servo_event_callback(void *context, uint32_t events)
4242

4343
Servo::Servo()
4444
{
45-
uint8_t servoIndex;
46-
4745
if (stm32l4_servo.state == SERVO_STATE_NONE) {
4846
stm32l4_servo_create(&stm32l4_servo, TIMER_INSTANCE_TIM15, STM32L4_SERVO_IRQ_PRIORITY);
4947
}

system/libstm32l4_dragonfly/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LD = $(TOOLS)/bin/arm-none-eabi-ld
88
CFLAGS = -mcpu=cortex-m4 -mthumb -c -g -Os $(WARNINGS) -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD $(EXTRAS) $(DEFINES) $(INCLUDES)
99
CXXFLAGS = -mcpu=cortex-m4 -mthumb -c -g -Os $(WARNINGS) -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD $(EXTRAS) $(DEFINES) $(INCLUDES)
1010
ASFLAGS = -c -g -x assembler-with-cpp $(EXTRAS) $(DEFINES) $(INCLUDES)
11-
WARNINGS = -w
11+
WARNINGS = -Wall -Wextra -Wno-unused-parameter
1212
EXTRAS = -DSTM32L476xx -D__FPU_PRESENT=1 -march=armv7e-m -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mabi=aapcs -mslow-flash-data
1313
DEFINES = -F_CPU=80000000L -DARDUINO=10606 -D_ARDUINO_STM32L4_DRAGONFLY -DARDUINO_ARCH_STM32L4
1414
INCLUDES = -I../../system/libstm32l4_dragonfly/CMSIS/Include -I../../system/libstm32l4_dragonfly/CMSIS/Device/ST/STM32L4xx/Include -I../../system/libstm32l4_dragonfly/USB/HAL/Inc -I../../system/libstm32l4_dragonfly/USB/Core/Inc -I../../system/libstm32l4_dragonfly/USB/Class/CDC/Inc -I../../system/libstm32l4_dragonfly/USB/Class/MSC/Inc -I../../system/libstm32l4_dragonfly/USB -I../../system/libstm32l4_dragonfly/ -I../../variants/dragonfly -I.

system/libstm32l4_dragonfly/USB/Class/CDC/Inc/usbd_cdc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ typedef struct
118118
uint8_t CmdOpCode;
119119
uint8_t CmdLength;
120120
uint8_t *RxBuffer;
121-
uint8_t *TxBuffer;
121+
const uint8_t *TxBuffer;
122122
uint32_t RxLength;
123123
uint32_t TxLength;
124124

@@ -141,7 +141,7 @@ USBD_CDC_HandleTypeDef;
141141
* @{
142142
*/
143143

144-
extern USBD_ClassTypeDef USBD_CDC;
144+
extern const USBD_ClassTypeDef USBD_CDC;
145145
#define USBD_CDC_CLASS &USBD_CDC
146146
/**
147147
* @}
@@ -151,10 +151,10 @@ extern USBD_ClassTypeDef USBD_CDC;
151151
* @{
152152
*/
153153
uint8_t USBD_CDC_RegisterInterface (USBD_HandleTypeDef *pdev,
154-
USBD_CDC_ItfTypeDef *fops);
154+
const USBD_CDC_ItfTypeDef *fops);
155155

156156
uint8_t USBD_CDC_SetTxBuffer (USBD_HandleTypeDef *pdev,
157-
uint8_t *pbuff,
157+
const uint8_t *pbuff,
158158
uint16_t length);
159159

160160
uint8_t USBD_CDC_SetRxBuffer (USBD_HandleTypeDef *pdev,

0 commit comments

Comments
 (0)