Skip to content

Commit

Permalink
viva la edición 2018!
Browse files Browse the repository at this point in the history
  • Loading branch information
little-arhat committed Mar 7, 2019
1 parent 4cf136d commit 3e7057f
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 52 deletions.
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0"
name = "alt-stm32f30x-hal"
repository = "https://github.com/copterust/alt-stm32f30x-hal"
version = "0.13.1-alpha.0"
edition = "2018"

[dependencies]
cortex-m = "0.5.8"
Expand All @@ -18,9 +19,10 @@ bitrate = "0.1.1"
[dependencies.stm32f30x]
version = "0.8.0"

[dependencies.embedded-hal]
version = "0.2.2"
[dependencies.hal]
features = ["unproven"]
version = "0.2.2"
package = "embedded-hal"

[dependencies.void]
default-features = false
Expand Down
2 changes: 1 addition & 1 deletion src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use cast::u32;
use cortex_m::peripheral::syst::SystClkSource;
use cortex_m::peripheral::SYST;

use crate::rcc::Clocks;
use hal::blocking::delay::{DelayMs, DelayUs};
use rcc::Clocks;

/// System timer (SysTick) as a delay provider
pub struct Delay {
Expand Down
2 changes: 1 addition & 1 deletion src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// should be Cargo features that let you select different microcontroller
// packages

use crate::rcc::AHB;
use bobbin_bits::*;
use core::intrinsics::transmute;
use core::marker::PhantomData;
use hal::digital::{toggleable, InputPin, OutputPin, StatefulOutputPin};
use rcc::AHB;

/// Marker trait for any pin
pub trait GPIOPin {}
Expand Down
14 changes: 7 additions & 7 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use cast::u8;
use stm32f30x::{I2C1, I2C2, RCC};

use gpio::{AltFn, PinMode, PullType};
use gpio::{HighSpeed, PushPull, AF4};
use gpio::{PA10, PA14, PA15, PA9};
use gpio::{PB6, PB7, PB8, PB9};
use gpio::{PF0, PF1, PF6};
use crate::gpio::{AltFn, PinMode, PullType};
use crate::gpio::{HighSpeed, PushPull, AF4};
use crate::gpio::{PA10, PA14, PA15, PA9};
use crate::gpio::{PB6, PB7, PB8, PB9};
use crate::gpio::{PF0, PF1, PF6};
use crate::rcc::Clocks;
use crate::time::Hertz;
use hal::blocking::i2c::{Read, Write, WriteRead};
use rcc::Clocks;
use time::Hertz;

/// I2C error
#[derive(Debug)]
Expand Down
9 changes: 1 addition & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,7 @@
#![deny(warnings)]
#![no_std]

extern crate bitrate;
extern crate bobbin_bits;
extern crate cast;
extern crate cortex_m;
extern crate embedded_hal as hal;
extern crate nb;
pub extern crate stm32f30x;
extern crate void;
pub use stm32f30x;

pub mod bb;
pub mod delay;
Expand Down
16 changes: 8 additions & 8 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
pub use crate::dma::DmaChannel as _stm32f30x_hal_dma_DmaChannel;
pub use crate::dma::DmaExt as _stm32f30x_hal_dma_DmaExt;
pub use crate::flash::FlashExt as _stm32f30x_hal_flash_FlashExt;
pub use crate::gpio::GpioExt as _stm32f30x_hal_gpio_GpioExt;
pub use crate::i2c::I2cExt as _stm32f30x_hal_i2ci_I2cExt;
pub use crate::pwm::PwmExt as _stm32f103xx_hal_pwm_PwmExt;
pub use crate::rcc::RccExt as _stm32f30x_hal_rcc_RccExt;
pub use crate::serial::ReadDma as _stm32f30x_hal_serial_ReadDma;
pub use crate::serial::SerialExt as _stm32f30x_hal_serial_SerialExt;
pub use crate::serial::WriteDma as _stm32f30x_hal_serial_WriteDma;
pub use flash::FlashExt as _stm32f30x_hal_flash_FlashExt;
pub use gpio::GpioExt as _stm32f30x_hal_gpio_GpioExt;
pub use crate::spi::SpiExt as _stm32f30x_hal_spi_SpiExt;
pub use crate::time::U32BitrateExt as _stm32f30x_hal_time_U32Ext;
pub use hal::prelude::*;
pub use i2c::I2cExt as _stm32f30x_hal_i2ci_I2cExt;
pub use pwm::PwmExt as _stm32f103xx_hal_pwm_PwmExt;
pub use rcc::RccExt as _stm32f30x_hal_rcc_RccExt;
pub use serial::SerialExt as _stm32f30x_hal_serial_SerialExt;
pub use spi::SpiExt as _stm32f30x_hal_spi_SpiExt;
pub use time::U32BitrateExt as _stm32f30x_hal_time_U32Ext;
4 changes: 2 additions & 2 deletions src/pwm.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Pwm
use crate::gpio;
use crate::timer;
use core::marker::PhantomData;
use gpio;
use hal;
use timer;

/// pwm
pub struct PwmBinding<P: gpio::GPIOPin,
Expand Down
4 changes: 2 additions & 2 deletions src/rcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use core::cmp;
use cast::u32;
use stm32f30x::{rcc, RCC};

use flash::ACR;
use time::Hertz;
use crate::flash::ACR;
use crate::time::Hertz;

/// Extension trait that constrains the `RCC` peripheral
pub trait RccExt {
Expand Down
17 changes: 8 additions & 9 deletions src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ use nb;
use stm32f30x::{Interrupt, RCC, USART1, USART2, USART3};
use void::Void;

// use crate::afio::MAPR;
use crate::dma::{dma1, CircBuffer, Static, Transfer, R, W};
use gpio::{AltFn, HighSpeed, PinMode, PullType, PushPull, AF7};
use gpio::{PA10, PA14, PA15, PA2, PA3, PA9};
use gpio::{PB10, PB11, PB3, PB4, PB6, PB7};
use gpio::{PC10, PC11, PC4, PC5};
use gpio::{PD5, PD6, PD8, PD9};
use gpio::{PE0, PE1, PE15};
use rcc::Clocks;
use time::Bps;
use crate::gpio::{AltFn, HighSpeed, PinMode, PullType, PushPull, AF7};
use crate::gpio::{PA10, PA14, PA15, PA2, PA3, PA9};
use crate::gpio::{PB10, PB11, PB3, PB4, PB6, PB7};
use crate::gpio::{PC10, PC11, PC4, PC5};
use crate::gpio::{PD5, PD6, PD8, PD9};
use crate::gpio::{PE0, PE1, PE15};
use crate::rcc::Clocks;
use crate::time::Bps;

/// Interrupt event
pub enum Event {
Expand Down
14 changes: 7 additions & 7 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use hal::spi::{FullDuplex, Mode, Phase, Polarity};
use nb;
use stm32f30x::{RCC, SPI1, SPI2, SPI3};

use gpio::{AltFn, PullType, AF5, AF6};
use gpio::{HighSpeed, PinMode, PushPull};
use gpio::{PA5, PA6, PA7};
use gpio::{PB13, PB14, PB15, PB3, PB4, PB5};
use gpio::{PC10, PC11, PC12};
use rcc::Clocks;
use time::Hertz;
use crate::gpio::{AltFn, PullType, AF5, AF6};
use crate::gpio::{HighSpeed, PinMode, PushPull};
use crate::gpio::{PA5, PA6, PA7};
use crate::gpio::{PB13, PB14, PB15, PB3, PB4, PB5};
use crate::gpio::{PC10, PC11, PC12};
use crate::rcc::Clocks;
use crate::time::Hertz;

/// SPI error
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use cortex_m::peripheral::DCB;
use cortex_m::peripheral::DWT;

use crate::rcc::Clocks;
pub use bitrate::*;
use rcc::Clocks;

/// A monotonic nondecreasing timer
#[derive(Clone, Copy)]
Expand Down
8 changes: 4 additions & 4 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use nb;
use stm32f30x::{TIM2, TIM3, TIM4};
use void::Void;

use rcc::Clocks;
use time::Hertz;
use crate::rcc::Clocks;
use crate::time::Hertz;

#[doc(hidden)]
mod private {
Expand Down Expand Up @@ -268,8 +268,8 @@ macro_rules! tim {
pub mod $timmod {
use super::*;
use core::marker::PhantomData;
use rcc;
use rcc::Clocks;
use crate::rcc;
use crate::rcc::Clocks;

/// Timer channel
pub struct Channel<CN: ChNum, M: ChMode> {
Expand Down

0 comments on commit 3e7057f

Please sign in to comment.