1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![no_std]
#![deny(missing_docs)]
#![allow(non_camel_case_types)]
pub use hal::pac;
pub use hal::pac::Peripherals;
pub use nrf51_hal as hal;
pub mod display;
pub mod gpio;
pub mod led;
#[macro_export]
macro_rules! serial_port {
( $gpio:expr, $uart:expr, $speed:expr ) => {{
use microbit::hal::{gpio::Level, uart};
let pins = uart::Pins {
rxd: $gpio.p0_25.into_floating_input().degrade(),
txd: $gpio.p0_24.into_push_pull_output(Level::Low).degrade(),
cts: None,
rts: None,
};
uart::Uart::new($uart, pins, uart::Parity::EXCLUDED, $speed)
}};
}