Browse Source

Bumped stm32f0 dependency, changed interrupt handler, bumped version to 0.9.0

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
features/pwm v0.9.0
Daniel Egger 4 years ago
parent
commit
6b3f3bc34f
  1. 12
      Cargo.toml
  2. 8
      examples/led_hal_button_irq.rs
  3. 2
      src/i2c.rs
  4. 4
      src/lib.rs
  5. 2
      src/rcc.rs
  6. 6
      src/spi.rs

12
Cargo.toml

@ -7,7 +7,8 @@ categories = [
"no-std",
]
description = "Peripheral access API for STM32F0 series microcontrollers"
documentation = "https://docs.rs/stm32f0xx-hal"
documentation = "https://docs.rs/crate/stm32f0xx-hal"
keywords = [
"arm",
"cortex-m",
@ -18,15 +19,18 @@ license = "0BSD"
name = "stm32f0xx-hal"
readme = "README.md"
repository = "https://github.com/stm32-rs/stm32f0xx-hal"
version = "0.8.0"
version = "0.9.0"
[package.metadata.docs.rs]
features = ["stm32f042", "rt"]
[dependencies]
bare-metal = { version = "0.2.4", features = ["const-fn"] }
cortex-m = "0.5.8"
cortex-m-rt = "0.6.6"
cortex-m-rt = "0.6.7"
nb = "0.1.1"
void = { version = "1.0.2", default-features = false }
stm32f0 = "0.4.0"
stm32f0 = "0.5.0"
[dependencies.cast]
default-features = false

8
examples/led_hal_button_irq.rs

@ -11,9 +11,8 @@ use crate::hal::prelude::*;
use cortex_m::interrupt::Mutex;
use cortex_m::peripheral::Peripherals as c_m_Peripherals;
use cortex_m_rt::entry;
use cortex_m_rt::{entry, interrupt};
pub use crate::hal::interrupt;
pub use crate::hal::stm32;
pub use crate::hal::stm32::*;
@ -87,9 +86,10 @@ fn main() -> ! {
/* Define an intterupt handler, i.e. function to call when exception occurs. Here if our external
* interrupt trips the flash function which will be called */
interrupt!(EXTI0_1, button_press);
//interrupt!(EXTI0_1, button_press);
fn button_press() {
#[interrupt]
fn EXTI0_1() {
// Enter critical section
cortex_m::interrupt::free(|cs| {
// Obtain all Mutex protected resources

2
src/i2c.rs

@ -3,6 +3,7 @@ use crate::stm32::{I2C1, RCC};
use embedded_hal::blocking::i2c::{Write, WriteRead};
use core::cmp;
#[cfg(feature = "stm32f042")]
use crate::gpio::gpioa::{PA10, PA11, PA12, PA9};
#[cfg(feature = "stm32f042")]
@ -12,7 +13,6 @@ use crate::gpio::gpiof::{PF0, PF1};
#[cfg(feature = "stm32f042")]
use crate::gpio::{Alternate, AF1, AF4, AF5};
use crate::time::{KiloHertz, U32Ext};
use core::cmp;
/// I2C abstraction
pub struct I2c<I2C, PINS> {

4
src/lib.rs

@ -13,10 +13,6 @@ pub use stm32f0::stm32f0x2 as stm32;
#[cfg(feature = "stm32f030")]
pub use stm32f0::stm32f0x0 as stm32;
// Enable use of interrupt macro
#[cfg(feature = "rt")]
pub use stm32f0::interrupt;
pub mod delay;
pub mod gpio;
pub mod i2c;

2
src/rcc.rs

@ -1,8 +1,8 @@
use core::cmp;
use cast::u32;
#[cfg(any(feature = "stm32f042", feature = "stm32f030"))]
use crate::stm32::{FLASH, RCC};
use cast::u32;
use crate::time::Hertz;

6
src/spi.rs

@ -39,8 +39,7 @@ impl Pins<SPI1>
gpioa::PA6<Alternate<AF0>>,
gpioa::PA7<Alternate<AF0>>,
)
{
}
{}
#[cfg(feature = "stm32f042")]
impl Pins<SPI1>
for (
@ -48,8 +47,7 @@ impl Pins<SPI1>
gpiob::PB4<Alternate<AF0>>,
gpiob::PB5<Alternate<AF0>>,
)
{
}
{}
#[cfg(feature = "stm32f042")]
impl<PINS> Spi<SPI1, PINS> {

Loading…
Cancel
Save