Browse Source

added drawing mod to the library, improved readme, fixed travis.yml, made rpi example working with a better pin config,

embedded-hal-1.0
Christoph Groß 8 years ago
parent
commit
2feff5b9fa
  1. 3
      .travis.yml
  2. 5
      README.md
  3. 8
      examples/embedded_linux/src/main.rs
  4. 16
      examples/f3_stm32f30x/Cargo.toml
  5. 9
      examples/f3_stm32f30x/src/main.rs
  6. 0
      src/drawing/mod.rs

3
.travis.yml

@ -100,7 +100,8 @@ script:
- cargo test - cargo test
- cargo test --release - cargo test --release
- cargo doc --release - cargo doc --release
- cd examples/embedded_linux && cargo build && cd ../f3_stm32f30x && cargo build - cd examples/embedded_linux && cargo build
#- cd ../f3_stm32f30x && cargo build
after_success: after_success:
- cargo doc-upload - cargo doc-upload

5
README.md

@ -4,6 +4,8 @@ IN WORK! Drivers for various EPDs from Waveshare. Currently only support for the
Be careful with the partial updates! Be careful with the partial updates!
It was only tested in a mBED implementation, this one wasn't tested yet!!! It was only tested in a mBED implementation, this one wasn't tested yet!!!
Due to a broken
## TODO's ## TODO's
- [ ] add some basic buffer drawing abilities - [ ] add some basic buffer drawing abilities
@ -29,8 +31,7 @@ Maybe add support for Non-Buffer drawing from the https://crates.io/crates/embed
There are some examples in the examples folder. There are some examples in the examples folder.
But be careful, I haven't found the time to actually test the examples yet and the pins are just choosen randomly atm. The f3 example is broken/working on a old version
So thats something that needs to be done first.
## Documenation ## Documenation

8
examples/embedded_linux/src/main.rs

@ -64,26 +64,26 @@ fn main() {
spi.configure(&options).unwrap(); spi.configure(&options).unwrap();
// Configure Digital I/O Pin to be used as Chip Select for SPI // Configure Digital I/O Pin to be used as Chip Select for SPI
let cs = Pin::new(23); let cs = Pin::new(7);//BCM7 CE0
cs.export().unwrap(); cs.export().unwrap();
while !cs.is_exported() {} while !cs.is_exported() {}
cs.set_direction(Direction::Out).unwrap(); cs.set_direction(Direction::Out).unwrap();
cs.set_value(1).unwrap(); cs.set_value(1).unwrap();
let busy = Pin::new(26); let busy = Pin::new(5);//pin 29
busy.export().unwrap(); busy.export().unwrap();
while !busy.is_exported() {} while !busy.is_exported() {}
busy.set_direction(Direction::In).unwrap(); busy.set_direction(Direction::In).unwrap();
busy.set_value(1).unwrap(); busy.set_value(1).unwrap();
let busy_in = HackInputPin::new(&busy); let busy_in = HackInputPin::new(&busy);
let dc = Pin::new(27); let dc = Pin::new(6); //pin 31 //bcm6
dc.export().unwrap(); dc.export().unwrap();
while !dc.is_exported() {} while !dc.is_exported() {}
dc.set_direction(Direction::Out).unwrap(); dc.set_direction(Direction::Out).unwrap();
dc.set_value(1).unwrap(); dc.set_value(1).unwrap();
let rst = Pin::new(28); let rst = Pin::new(16); //pin 36 //bcm16
rst.export().unwrap(); rst.export().unwrap();
while !rst.is_exported() {} while !rst.is_exported() {}
rst.set_direction(Direction::Out).unwrap(); rst.set_direction(Direction::Out).unwrap();

16
examples/f3_stm32f30x/Cargo.toml

@ -4,14 +4,20 @@ version = "0.1.0"
authors = ["Christoph Groß <christoph.gross@student.uni-tuebingen.de>"] authors = ["Christoph Groß <christoph.gross@student.uni-tuebingen.de>"]
[dependencies] [dependencies]
f3 = "0.6.0" #f3 = "0.6.0"
cortex-m = {version = "0.5.2"} f3 = "0.5.3"
#cortex-m = {version = "0.5.2"}
cortex-m = {version = "0.4.3"}
#eink_waveshare_rs = { git = "https://github.com/Caemor/eink-waveshare-rs"}
eink_waveshare_rs = { path = "../../"}
eink_waveshare_rs = { git = "https://github.com/Caemor/eink-waveshare-rs", rev = "ba5d44a"}
#eink_waveshare_rs = { path = "../../"}
# only temporary until Digital::InputPin has arrived in f3 # only temporary until Digital::InputPin has arrived in f3
embedded-hal = { version = "0.2.1", features = ["unproven"] } #TODO: update to 0.2.1
embedded-hal = { version = "0.1.2", features = ["unproven"] }
# for #no_std # for #no_std
panic-abort = "0.1.1" panic-abort = "0.1.1"

9
examples/f3_stm32f30x/src/main.rs

@ -1,3 +1,4 @@
#![feature(start)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![no_std] #![no_std]
@ -26,11 +27,11 @@ use hal::digital::{InputPin, OutputPin};
//from https://github.com/rudihorn/max31865/tree/extra_examples/examples //from https://github.com/rudihorn/max31865/tree/extra_examples/examples
struct HackInputPin<'a> { struct HackInputPin<'a> {
pin: &'a Pin pin: &'a OutputPin
} }
impl<'a> HackInputPin<'a> { impl<'a> HackInputPin<'a> {
fn new(p : &'a Pin) -> HackInputPin { fn new(p : &'a OutputPin) -> HackInputPin {
HackInputPin { HackInputPin {
pin: p pin: p
} }
@ -53,6 +54,7 @@ impl<'a> InputPin for HackInputPin<'a> {
* *
*/ */
#[start]
fn main() { fn main() {
let cp = cortex_m::Peripherals::take().unwrap(); let cp = cortex_m::Peripherals::take().unwrap();
let p = stm32f30x::Peripherals::take().unwrap(); let p = stm32f30x::Peripherals::take().unwrap();
@ -75,7 +77,8 @@ fn main() {
//TODO: Fix when f3::hal includes Digital::InputPin //TODO: Fix when f3::hal includes Digital::InputPin
//using the hack from rudihorn that Digital::OutputPin basically //using the hack from rudihorn that Digital::OutputPin basically
//contains the needed functions for Digital::InputPin //contains the needed functions for Digital::InputPin
let busy = gpioe.pe4.into_floating_input(&mut gpioe.moder, &mut gpioe.pupdr); //let busy = gpioe.pe4.into_floating_input(&mut gpioe.moder, &mut gpioe.pupdr);
let busy = gpioe.pe4.into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper);
let busy_in = HackInputPin::new(&busy); let busy_in = HackInputPin::new(&busy);
let dc = gpioe.pe5.into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper); let dc = gpioe.pe5.into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper);

0
src/drawing/mod.rs

Loading…
Cancel
Save