mirror of https://github.com/ARMmbed/mbed-os.git
[NUCLEO_F103RB] Update rtc + serial
parent
57db78211c
commit
20fee9fbff
|
@ -87,7 +87,12 @@ void rtc_init(void) {
|
|||
}
|
||||
|
||||
void rtc_free(void) {
|
||||
RCC_DeInit(); // Resets the RCC clock configuration to the default reset state
|
||||
// Disable RTC, LSE and LSI clocks
|
||||
PWR_BackupAccessCmd(ENABLE); // Allow access to Backup Domain
|
||||
RCC_RTCCLKCmd(DISABLE);
|
||||
RCC_LSEConfig(RCC_LSE_OFF);
|
||||
RCC_LSICmd(DISABLE);
|
||||
|
||||
rtc_inited = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,12 +95,15 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
|
|||
// Enable USART clock
|
||||
if (obj->uart == UART_1) {
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
|
||||
obj->index = 0;
|
||||
}
|
||||
if (obj->uart == UART_2) {
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
|
||||
obj->index = 1;
|
||||
}
|
||||
if (obj->uart == UART_3) {
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
|
||||
obj->index = 2;
|
||||
}
|
||||
|
||||
// Configure the UART pins
|
||||
|
@ -118,11 +121,6 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
|
|||
|
||||
init_usart(obj);
|
||||
|
||||
// The index is used by irq
|
||||
if (obj->uart == UART_1) obj->index = 0;
|
||||
if (obj->uart == UART_2) obj->index = 1;
|
||||
if (obj->uart == UART_3) obj->index = 2;
|
||||
|
||||
// For stdio management
|
||||
if (obj->uart == STDIO_UART) {
|
||||
stdio_uart_inited = 1;
|
||||
|
|
Loading…
Reference in New Issue