Merge pull request #15193 from jeromecoutant/PR_WARNING

STM32 : remove several warnings
pull/15196/head
Martin Kojtal 2021-12-15 11:50:32 +00:00 committed by GitHub
commit 35050f02e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 41 additions and 39 deletions

View File

@ -188,8 +188,9 @@ uint32_t flash_get_size(const flash_t *obj)
static uint32_t GetSector(uint32_t address)
{
uint32_t sector = 0;
uint32_t tmp = address - ADDR_FLASH_SECTOR_0;
#if (MBED_CONF_TARGET_FLASH_DUAL_BANK) && defined(FLASH_OPTCR_nDBANK)
uint32_t tmp = address - ADDR_FLASH_SECTOR_0;
if (address < ADDR_FLASH_SECTOR_4) { // Sectors 0 to 3
sector += tmp >> 14;
} else if (address < ADDR_FLASH_SECTOR_5) { // Sector 4

View File

@ -1814,13 +1814,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_DMA(HRTIM_HandleTypeDef * hhrtim,
/* Check the parameters */
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel));
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
{
return HAL_BUSY;
}
if((hhrtim->State == HAL_HRTIM_STATE_READY))
if (hhrtim->State == HAL_HRTIM_STATE_READY)
{
if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
{
return HAL_ERROR;
}
@ -2458,13 +2458,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef * hhrtim,
/* Check the parameters */
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel));
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
{
return HAL_BUSY;
}
if((hhrtim->State == HAL_HRTIM_STATE_READY))
if (hhrtim->State == HAL_HRTIM_STATE_READY)
{
if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
{
return HAL_ERROR;
}
@ -6597,7 +6597,7 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart_DMA(HRTIM_HandleTypeDef * hhrtim,
/* Check the parameters */
assert_param(IS_HRTIM_TIMERID(Timers));
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
{
return HAL_BUSY;
}
@ -7159,13 +7159,13 @@ HAL_StatusTypeDef HAL_HRTIM_BurstDMATransfer(HRTIM_HandleTypeDef *hhrtim,
/* Check the parameters */
assert_param(IS_HRTIM_TIMERINDEX(TimerIdx));
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
{
return HAL_BUSY;
}
if((hhrtim->State == HAL_HRTIM_STATE_READY))
if (hhrtim->State == HAL_HRTIM_STATE_READY)
{
if((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U))
if ((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U))
{
return HAL_ERROR;
}

View File

@ -641,7 +641,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
}
if (type == FlowControlRTS) {
// Enable RTS
MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC);
MBED_ASSERT(pinmap->rx_flow_pin != NC);
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS;
obj_s->pin_rts = pinmap->rx_flow_pin;
// Enable the pin for RTS function
@ -650,7 +650,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
}
if (type == FlowControlCTS) {
// Enable CTS
MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC);
MBED_ASSERT(pinmap->tx_flow_pin != NC);
obj_s->hw_flow_ctl = UART_HWCONTROL_CTS;
obj_s->pin_cts = pinmap->tx_flow_pin;
// Enable the pin for CTS function
@ -659,8 +659,8 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
}
if (type == FlowControlRTSCTS) {
// Enable CTS & RTS
MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC);
MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC);
MBED_ASSERT(pinmap->rx_flow_pin != NC);
MBED_ASSERT(pinmap->tx_flow_pin != NC);
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS_CTS;
obj_s->pin_rts = pinmap->rx_flow_pin;;
obj_s->pin_cts = pinmap->tx_flow_pin;;

View File

@ -1618,13 +1618,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_DMA(HRTIM_HandleTypeDef * hhrtim,
/* Check the parameters */
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel));
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
{
return HAL_BUSY;
}
if((hhrtim->State == HAL_HRTIM_STATE_READY))
if (hhrtim->State == HAL_HRTIM_STATE_READY)
{
if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
{
return HAL_ERROR;
}
@ -2235,13 +2235,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef * hhrtim,
/* Check the parameters */
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel));
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
{
return HAL_BUSY;
}
if((hhrtim->State == HAL_HRTIM_STATE_READY))
if (hhrtim->State == HAL_HRTIM_STATE_READY)
{
if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
{
return HAL_ERROR;
}
@ -5329,7 +5329,7 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart_DMA(HRTIM_HandleTypeDef * hhrtim,
/* Check the parameters */
assert_param(IS_HRTIM_TIMERID(Timers));
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
{
return HAL_BUSY;
}
@ -5764,13 +5764,13 @@ HAL_StatusTypeDef HAL_HRTIM_BurstDMATransfer(HRTIM_HandleTypeDef *hhrtim,
/* Check the parameters */
assert_param(IS_HRTIM_TIMERINDEX(TimerIdx));
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
{
return HAL_BUSY;
}
if((hhrtim->State == HAL_HRTIM_STATE_READY))
if (hhrtim->State == HAL_HRTIM_STATE_READY)
{
if((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U))
if ((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U))
{
return HAL_ERROR;
}

View File

@ -60,7 +60,7 @@ void analogin_init(analogin_t *obj, PinName pin)
// ADC Internal Channels "pins" (Temperature, Vref, Vbat, ...)
// are described in PinNames.h and PeripheralPins.c
// Pin value must be between 0xF0 and 0xFF
if ((pin < 0xF0) || (pin >= ALT0)) {
if ((pin < 0xF0) || (pin >= (PinName)ALT0)) {
// Normal channels
// Get the peripheral name from the pin and assign it to the object
obj->handle.Instance = (ADC_TypeDef *)pinmap_peripheral(pin, PinMap_ADC);

View File

@ -104,7 +104,8 @@
#error 'The HAL CAN driver cannot be used with its legacy, Please ensure to enable only one HAL CAN module at once in stm32l4xx_hal_conf.h file'
#endif /* HAL_CAN_MODULE_ENABLED */
#warning 'Legacy HAL CAN driver is enabled! It can be used with known limitations, refer to the release notes. However it is recommended to use rather the new HAL CAN driver'
// MBED current implementation
// #warning 'Legacy HAL CAN driver is enabled! It can be used with known limitations, refer to the release notes. However it is recommended to use rather the new HAL CAN driver'
#if defined(CAN1)

View File

@ -654,7 +654,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
}
if (type == FlowControlRTS) {
// Enable RTS
MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC);
MBED_ASSERT(pinmap->rx_flow_pin != NC);
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS;
obj_s->pin_rts = pinmap->rx_flow_pin;
// Enable the pin for RTS function
@ -663,7 +663,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
}
if (type == FlowControlCTS) {
// Enable CTS
MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC);
MBED_ASSERT(pinmap->tx_flow_pin != NC);
obj_s->hw_flow_ctl = UART_HWCONTROL_CTS;
obj_s->pin_cts = pinmap->tx_flow_pin;
// Enable the pin for CTS function
@ -672,8 +672,8 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
}
if (type == FlowControlRTSCTS) {
// Enable CTS & RTS
MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC);
MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC);
MBED_ASSERT(pinmap->rx_flow_pin != NC);
MBED_ASSERT(pinmap->tx_flow_pin != NC);
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS_CTS;
obj_s->pin_rts = pinmap->rx_flow_pin;;
obj_s->pin_cts = pinmap->tx_flow_pin;;

View File

@ -142,16 +142,16 @@ static void _can_init_freq_direct(can_t *obj, const can_pinmap_t *pinmap, int hz
// We use PLL1.Q clock right now so get its frequency
PLL1_ClocksTypeDef pll1_clocks;
HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks);
int ntq = pll1_clocks.PLL1_Q_Frequency / hz;
uint32_t ntq = pll1_clocks.PLL1_Q_Frequency / (uint32_t)hz;
#else
#if (defined RCC_PERIPHCLK_FDCAN1)
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / hz;
uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / (uint32_t)hz;
#else
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / hz;
uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / (uint32_t)hz;
#endif
#endif
int nominalPrescaler = 1;
uint32_t nominalPrescaler = 1;
// !When the sample point should be lower than 50%, this must be changed to
// !IS_FDCAN_NOMINAL_TSEG2(ntq/nominalPrescaler), since
// NTSEG2 and SJW max values are lower. For now the sample point is fix @75%
@ -322,16 +322,16 @@ int can_frequency(can_t *obj, int f)
// STM32H7 doesn't support yet HAL_RCCEx_GetPeriphCLKFreq for FDCAN
PLL1_ClocksTypeDef pll1_clocks;
HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks);
int ntq = pll1_clocks.PLL1_Q_Frequency / f;
uint32_t ntq = pll1_clocks.PLL1_Q_Frequency / (uint32_t)f;
#else
#if (defined RCC_PERIPHCLK_FDCAN1)
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / f;
uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / (uint32_t)f;
#else
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / f;
uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / (uint32_t)f;
#endif
#endif
int nominalPrescaler = 1;
uint32_t nominalPrescaler = 1;
// !When the sample point should be lower than 50%, this must be changed to
// !IS_FDCAN_DATA_TSEG2(ntq/nominalPrescaler), since
// NTSEG2 and SJW max values are lower. For now the sample point is fix @75%