Move the led_ring module to a local crate

The library will allow for the tests to be actually run.
If we try to run the tests through the main binary this fails
due to missing a eh_personality language item.
This commit is contained in:
Paul van Tilburg 2019-04-11 20:09:43 +02:00
parent 2e23acb335
commit 6e8de672ea
Signed by: paul
GPG Key ID: C6DE073EDA9EEC4D
3 changed files with 8 additions and 3 deletions

View File

@ -24,6 +24,10 @@ package = "stm32f4xx-hal"
version = "0.3.0"
features = ["rt", "stm32f407"]
[lib]
name = "stm32f4disc_demo"
path = "src/lib.rs"
[[bin]]
name = "stm32f4disc-demo"
test = false

2
src/lib.rs Normal file
View File

@ -0,0 +1,2 @@
#![cfg_attr(not(test), no_std)]
pub mod led_ring;

View File

@ -8,10 +8,8 @@
#![no_main]
#![no_std]
mod led_ring;
use crate::led_ring::LedRing;
use core::fmt::Write;
use cortex_m_semihosting::hprintln;
use hal::{
block,
@ -25,6 +23,7 @@ use heapless::{consts::U8, Vec};
#[cfg(not(test))]
use panic_semihosting as _;
use rtfm::app;
use stm32f4disc_demo::led_ring::LedRing;
type Accelerometer = hal::spi::Spi<SPI1, (Spi1Sck, Spi1Miso, Spi1Mosi)>;
type AccelerometerCs = hal::gpio::gpioe::PE3<Output<PushPull>>;