STM32F411: simplify serial and get rid of mbed-pinmap_common.c.
We have only one UART, we use only one UART, so it's pointless to
do pin mapping calculations at runtime.
SIZES ARM... stm32f411
FLASH : 4832 bytes 1%
RAM : 404 bytes 1%
EEPROM : 0 bytes 0%
This commit is contained in:
parent
d44c03a1b7
commit
79010723b1
|
|
@ -88,12 +88,9 @@ static void mbed_init_uart(serial_t *obj)
|
|||
|
||||
void mbed_serial_init(serial_t *obj, PinName tx, PinName rx)
|
||||
{
|
||||
// Determine the UART to use (UART_1, UART_2, ...)
|
||||
UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
|
||||
UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
|
||||
|
||||
// Get the peripheral name (UART_1, UART_2, ...) from the pin and assign it to the object
|
||||
obj->uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
||||
obj->uart = UART_2;
|
||||
|
||||
// Enable USART clock
|
||||
switch (obj->uart) {
|
||||
|
|
@ -144,14 +141,10 @@ void mbed_serial_init(serial_t *obj, PinName tx, PinName rx)
|
|||
}
|
||||
|
||||
// Configure the UART pins
|
||||
pinmap_pinout(tx, PinMap_UART_TX);
|
||||
pinmap_pinout(rx, PinMap_UART_RX);
|
||||
if (tx != NC) {
|
||||
pin_function(tx, 0x393);
|
||||
pin_mode(tx, PullUp);
|
||||
}
|
||||
if (rx != NC) {
|
||||
pin_function(rx, 0x393);
|
||||
pin_mode(rx, PullUp);
|
||||
}
|
||||
|
||||
// Configure UART
|
||||
obj->baudrate = 9600;
|
||||
|
|
@ -477,11 +470,6 @@ void mbed_serial_clear(serial_t *obj)
|
|||
__HAL_UART_CLEAR_FLAG(&UartHandle, UART_FLAG_RXNE);
|
||||
}
|
||||
|
||||
void mbed_serial_pinout_tx(PinName tx)
|
||||
{
|
||||
pinmap_pinout(tx, PinMap_UART_TX);
|
||||
}
|
||||
|
||||
void mbed_serial_break_set(serial_t *obj)
|
||||
{
|
||||
UartHandle.Instance = (USART_TypeDef *)(obj->uart);
|
||||
|
|
|
|||
Loading…
Reference in New Issue