mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #5818 from makomi/stm32f3
cpu/stm32f3: uart: suppress cppcheck nullPointer errors
This commit is contained in:
commit
797ab580c8
@ -119,6 +119,12 @@ static int init_base(uart_t uart, uint32_t baudrate)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure port and dev are != NULL here, i.e. that the variables are
|
||||||
|
* assigned in all non-returning branches of the switch at the top of this
|
||||||
|
* function. */
|
||||||
|
assert(port != NULL);
|
||||||
|
assert(dev != NULL);
|
||||||
|
|
||||||
/* uart_configure RX and TX pins, set pin to use alternative function mode */
|
/* uart_configure RX and TX pins, set pin to use alternative function mode */
|
||||||
port->MODER &= ~(3 << (rx_pin * 2) | 3 << (tx_pin * 2));
|
port->MODER &= ~(3 << (rx_pin * 2) | 3 << (tx_pin * 2));
|
||||||
port->MODER |= 2 << (rx_pin * 2) | 2 << (tx_pin * 2);
|
port->MODER |= 2 << (rx_pin * 2) | 2 << (tx_pin * 2);
|
||||||
@ -178,6 +184,10 @@ void uart_write(uart_t uart, const uint8_t *data, size_t len)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure dev is != NULL here, i.e. that the variable is assigned in
|
||||||
|
* all non-returning branches of the switch at the top of this function. */
|
||||||
|
assert(dev != NULL);
|
||||||
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
while (!(dev->ISR & USART_ISR_TXE)) {}
|
while (!(dev->ISR & USART_ISR_TXE)) {}
|
||||||
dev->TDR = data[i];
|
dev->TDR = data[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user