Created
April 10, 2018 20:32
-
-
Save jcsoo/29e29fa6cb93cf56595195eebd7491af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub use mcu::bobbin_common::console::*; | |
use mcu::bobbin_common::periph::IntoPeriph; | |
use mcu::rcc::*; | |
use mcu::usart::*; | |
use mcu::pin::*; | |
pub const USART: Usart3 = USART3; | |
const USART_TX: Pd8 = PD8; | |
const USART_RX: Pd9 = PD9; | |
const USART_CLOCK: u32 = 16_000_000; // Use HSI Clock | |
const USART_BAUD: u32 = 115_200; | |
pub fn init() { | |
USART_TX | |
.port_gate_enable() | |
.connect_to(USART); | |
USART_RX | |
.port_gate_enable() | |
.connect_to(USART); | |
USART | |
.set_clock_source(DedicatedClock::Hsi) | |
.gate_enable() | |
.set_config(|c| c.set_baud_clock(USART_BAUD, USART_CLOCK)) | |
.enable(); | |
set_console(Console::new(USART.into_periph())); | |
} | |
impl super::NucleoF746zg { | |
pub fn console(&self) -> Console { | |
Console::new(USART.into_periph()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment