Giter Site home page Giter Site logo

stm32f3-discovery's Introduction

stm32f3-discovery

Board support package for the STM32F3DISCOVERY board.

Rust crates.io crates.io docs.rs

Dependencies

To build embedded programs using this you'll need:

  • Rust 1.51 or newer toolchain
  • rust-std components (pre-compiled core crate) for the ARM Cortex-M target.
$ cargo install cargo-generate
$ rustup target add thumbv7em-none-eabihf

For more info on working with embedded Rust, see the Embedded Rust Book and the Discovery Book.

Documentation

https://docs.rs/stm32f3-discovery

For the board specific functionality this crate adds, see:

VS Code

This repository includes launch configurations for debugging CortexM programs with Visual Studio Code in the .vscode/ directory.
See .vscode/README.md for more information.

To debug one of the examples, open the example source file in the editor and press F5.

License

This template is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Changelog

Unreleased

  • Bump HAL to 0.8.0 for getting back MonoTimer which was accidentially droped with release 0.6.1 and came back with the latest release.

0.7.2

Implements the Accelerometer trait from the Accelerometer crate.

0.7.1

  • Implements an Iterator for the Leds struct and introduced the Leds::iter_mut() method.

    Testing shows that direct iteration over the leds using Leds::iter_mut() can save up to 800 bytes off the size of the final binary over the old Leds::into_array() method.

    See: #41

  • Adds the ability to obtain a mutable reference to a led based on it's compass direction on the board.

    See: Leds::for_direction()

    Contributed by Christian Meusel

0.7.0

Updates stm32f3xx-hal to 0.7.0. Since we re-export the stm32f3xx-hal, any breaking changes in their API are also breaking changes in ours. For details see the stm32f3xx-hal changelog

Although the minimum Rust version is technically still 1.49, because of changes to embedded_time, the minimum version of Cargo is now 1.51, so we're updating our MSRV to 1.51.

0.6.1

Update cortex-m, cortex-m-rt, and switch-hal dependencies.

0.6.0

Update stm32f3xx-hal version.
stm32f3xx-hal had breaking changes.
Since we re-export the HAL, that means we also had breaking changes.

For details, see the stm32f3xx-hal changelog.

0.5.0

  • Updated dependencies
  • InputSwitch for UserButton now has an Error type of core::convert::Infallible instead of ()

0.4.0

  • Updated stm32f3xx-hal from 0.4.0 to 0.4.1
  • Allows setting TriggerMode on the user button (breaking change)
  • Removes deprecated GpioE struct and Leds::init function

0.3.4

  • Introduced Compass struct and implemented Accelerometer trait.
  • Add Leds::new function and deprecate Leds::init.

0.3.3

  • Add wait_for_interrupt function
  • Upgrade switch-hal version

0.3.2

  • Re-export lsm303dhlc driver

stm32f3-discovery's People

Contributors

phijor avatar rubberduck203 avatar sim82 avatar simsys avatar sirhcel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stm32f3-discovery's Issues

Create LED abstraction

There are 8 user leds on board, LD3-LD10, arranged in a "compass".
Provide

  • A LED trait with on and off functions
  • Allows users to access the leds via the names printed on the board rather than the GPIO they're connected to (i.e. PE13, etc.)
  • Allow users to access the leds via their "direction" on the compass (N/S/E/W are printed on the board).
  • Bonus points for being able to iterate through all 8 LEDs

Allow LED access via compass direction

Currently, the led abstraction allows access via their names (ld3, etc).
The board is also labeled with directions.
Allow users to access the Leds via the direction, North, South, East, West, etc.

Related: #4, #8.

Release 0.6

PR #36 updated the stm32fx hal.
There were breaking changes and since we re-export the hal, we also have breaking changes.
Release new version with release notes documenting the breaking change.

Change Leds to use a Compass like construction

Instead of taking ownership of the entire GPIOE port and returning a new struct that only has the pins that aren't owned by the Leds struct, just give the Leds ctor the pins it's needs.
Also, change init to new for consistency with the other periphs.

Not receiving any magnetometer data

Hi!

I'm learning embedded rust and currently trying to control the compass leds of the STM32F3 discovery board using the magnetometer data. I was able to setup everything and I get logs from the accelerometer, but not from the magnetometer.

I used the example code from examples/compass.rs and I'm running rust 1.53.0. Any ideas on what I might be overlooking?

Accel:I16x3 { x: -128, y: -896, z: 16512 }; Mag:I16x3 { x: 0, y: 0, z: 0 }
Accel:I16x3 { x: -320, y: -704, z: 16512 }; Mag:I16x3 { x: 0, y: 0, z: 0 }
Accel:I16x3 { x: -192, y: -576, z: 16448 }; Mag:I16x3 { x: 0, y: 0, z: 0 }
Accel:I16x3 { x: -128, y: -768, z: 16512 }; Mag:I16x3 { x: 0, y: 0, z: 0 }
Accel:I16x3 { x: -256, y: -704, z: 16384 }; Mag:I16x3 { x: 0, y: 0, z: 0 }
Accel:I16x3 { x: -320, y: -768, z: 16512 }; Mag:I16x3 { x: 0, y: 0, z: 0 }

Thanks!

Add warnings for 2 tricky problems I had.

I had 2 problems with the examples which required non-obvious fixes.

  1. To make OpenOCD work under Windows 10, I had to use a USB 2.0 port, not a USB 3.1 port.
  2. To make ITM output work ,I had to solder over the SB10 solder bridge on the Discovery board.

Info about cargo-flash/cargo-embed

How do you think would it be helpful for newcomers to note in this repo or may be in discovery book about easiest way to try examples with discovery board:

cargo install cargo-flash
cargo flash --chip stm32f3 --example leds --connect-under-reset

I think it can help newcomers to to start as quick as they type only 3 commands.

Create `ActiveHighLed` and `ActiveLowLed` implementations of LED trait

Much like was done for with the button::hal, allow users to create their own LEDs from externally wired sources.

use stm32f3xx_hal::hal::digital::v2::InputPin;
pub trait Button {
type Error;
fn is_pressed(&self) -> Result<bool, Self::Error>;
}
pub struct ActiveHighButton<T>
where
T: InputPin,
{
pin: T,
}
impl<T: InputPin> ActiveHighButton<T> {
pub fn new(pin: T) -> Self {
ActiveHighButton { pin: pin }
}
}
impl<T: InputPin> Button for ActiveHighButton<T> {
type Error = <T as stm32f3xx_hal::hal::digital::v2::InputPin>::Error;
fn is_pressed(&self) -> Result<bool, Self::Error> {
self.pin.is_high()
}
}
pub struct ActiveLowButton<T>
where
T: InputPin,
{
pin: T,
}
impl<T: InputPin> ActiveLowButton<T> {
pub fn new(pin: T) -> Self {
ActiveLowButton { pin: pin }
}
}
impl<T: InputPin> Button for ActiveLowButton<T> {
type Error = <T as stm32f3xx_hal::hal::digital::v2::InputPin>::Error;
fn is_pressed(&self) -> Result<bool, Self::Error> {
self.pin.is_low()
}
}

pub trait Led {
fn on(&mut self);
fn off(&mut self);
fn toggle(&mut self);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.