Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
david-sawatzke committed Jan 1, 2019
1 parent ed09c2a commit d44a5d0
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions examples/unused.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//! This is not intended to be used on a real system
#![no_main]
#![no_std]

#[allow(unused)]
use panic_halt;

use stm32f0xx_hal as hal;

use crate::hal::gpio::Unused;
use crate::hal::i2c::I2c;
use crate::hal::prelude::*;
use crate::hal::serial::Serial;
use crate::hal::spi::Spi;
use crate::hal::spi::{Mode, Phase, Polarity};
use crate::hal::stm32;

use cortex_m_rt::entry;
#[entry]
fn main() -> ! {
const MODE: Mode = Mode {
polarity: Polarity::IdleHigh,
phase: Phase::CaptureOnSecondTransition,
};

if let Some(p) = stm32::Peripherals::take() {
let rcc = p.RCC.constrain();
let clocks = rcc.cfgr.freeze();

let _ = Spi::spi1(
p.SPI1,
(Unused::new(), Unused::new(), Unused::new()),
MODE,
100_000.hz(),
clocks,
);
let _ = Serial::usart1(
p.USART1,
(Unused::new(), Unused::new()),
115_200.bps(),
clocks,
);
let _ = I2c::i2c1(p.I2C1, (Unused::new(), Unused::new()), 400.khz());
}
loop {
continue;
}
}

0 comments on commit d44a5d0

Please sign in to comment.