Giter Site home page Giter Site logo

stm32f3-discovery's Issues

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.

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

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!

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);
}

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.

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.

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.