Browse Source

Merge pull request #10 from Caemor/STM32F3DISCOVERY-Beispiel

Added example and tests for stm32f3discovery 

Added an example for stm32f3discovery, which also adds automatic (via travis) build tests for the stm32f3
embedded-hal-1.0
Chris 7 years ago committed by GitHub
parent
commit
e489b7af30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .travis.yml
  2. 4
      examples/Readme.md
  3. 2
      examples/stm32f3discovery/Cargo.toml
  4. 58
      examples/stm32f3discovery/src/main.rs

2
.travis.yml

@ -93,6 +93,7 @@ before_install:
install: install:
- cargo install cargo-travis || true - cargo install cargo-travis || true
- rustup override set nightly - rustup override set nightly
- rustup target add thumbv7m-none-eabi
script: script:
- cargo check - cargo check
@ -102,6 +103,7 @@ script:
- cargo doc --all-features --release - cargo doc --all-features --release
- cd examples/embedded_linux_epd4in2 && cargo check && cd ../../ - cd examples/embedded_linux_epd4in2 && cargo check && cd ../../
- cd examples/embedded_linux_epd1in54 && cargo check && cd ../../ - cd examples/embedded_linux_epd1in54 && cargo check && cd ../../
- cd examples/stm32f3discovery && cargo check --target thumbv7m-none-eabi && cd ../../
#- cd ../f3_stm32f30x && cargo build #- cd ../f3_stm32f30x && cargo build
after_success: after_success:

4
examples/Readme.md

@ -9,3 +9,7 @@ It showcases most of what can be done with the crate.
### embedded_linux_epd1in54 ### embedded_linux_epd1in54
This example doesn't use the graphics feature of the crate and shows the fast update rate of the 1in54 EPD. This example doesn't use the graphics feature of the crate and shows the fast update rate of the 1in54 EPD.
### stm32f3discovery
Not tested yet!

2
examples/stm32f3discovery/Cargo.toml

@ -1,5 +1,5 @@
[package] [package]
name = "STM32F3DISCOVERY-EInk-Example" name = "stm32_f3_discovery_eink_example"
version = "0.1.0" version = "0.1.0"
authors = ["Christoph Groß <christoph-gross@mailbox.org>"] authors = ["Christoph Groß <christoph-gross@mailbox.org>"]

58
examples/stm32f3discovery/src/main.rs

@ -73,7 +73,7 @@ fn main() -> ! {
cs.set_high(); cs.set_high();
// // Configure Busy Input Pin // // Configure Busy Input Pin
let mut busy = gpioe let busy = gpioe
.pe4 .pe4
.into_floating_input(&mut gpioe.moder, &mut gpioe.pupdr); .into_floating_input(&mut gpioe.moder, &mut gpioe.pupdr);
// .pe4 // .pe4
@ -132,46 +132,40 @@ fn main() -> ! {
// // Now the "real" usage of the eink-waveshare-rs crate begins // // Now the "real" usage of the eink-waveshare-rs crate begins
let mut epd = EPD1in54::new(spi, cs, busy, dc, rst, delay).unwrap(); let mut epd = EPD1in54::new(spi, cs, busy, dc, rst, delay).unwrap();
//let mut l3gd20 = L3gd20::new(spi, nss).unwrap();
//let _m = l3gd20.all().unwrap();
// when you reach this breakpoint you'll be able to inspect the variable `_m` which contains the // Clear the full screen
// gyroscope and the temperature sensor readings epd.clear_frame().unwrap();
//asm::bkpt(); epd.display_frame().unwrap();
// // Clear the full screen // Speeddemo
// epd.clear_frame(); let small_buffer = [Color::Black.get_byte_value(), 16 as u8 / 8 * 16 as u8];
// epd.display_frame(); let number_of_runs = 100;
for i in 0..number_of_runs {
let offset = i * 8 % 150;
epd.update_partial_frame(&small_buffer, 25 + offset, 25 + offset, 16, 16).unwrap();
epd.display_frame().unwrap();
}
// // Speeddemo // Clear the full screen
// let small_buffer = [Color::Black.get_byte_value(), 16 as u8 / 8 * 16 as u8]; epd.clear_frame().unwrap();
// let number_of_runs = 100; epd.display_frame().unwrap();
// for i in 0..number_of_runs {
// let offset = i * 8 % 150;
// epd.update_partial_frame(&small_buffer, 25 + offset, 25 + offset, 16, 16)?;
// epd.display_frame()?;
// }
// // Clear the full screen // Draw some squares
// epd.clear_frame(); let mut small_buffer = [Color::Black.get_byte_value(), 160 as u8 / 8 * 160 as u8];
// epd.display_frame(); epd.update_partial_frame(&small_buffer, 20, 20, 160, 160).unwrap();
// // Draw some squares small_buffer = [Color::White.get_byte_value(), 80 as u8 / 8 * 80 as u8];
// let mut small_buffer = [Color::Black.get_byte_value(), 160 as u8 / 8 * 160 as u8]; epd.update_partial_frame(&small_buffer, 60, 60, 80, 80).unwrap();
// epd.update_partial_frame(&small_buffer, 20, 20, 160, 160)?;
// small_buffer = [Color::White.get_byte_value(), 80 as u8 / 8 * 80 as u8]; small_buffer = [Color::Black.get_byte_value(), 8];
// epd.update_partial_frame(&small_buffer, 60, 60, 80, 80)?; epd.update_partial_frame(&small_buffer, 96, 96, 8, 8).unwrap();
// small_buffer = [Color::Black.get_byte_value(), 8]; // Display updated frame
// epd.update_partial_frame(&small_buffer, 96, 96, 8, 8)?; epd.display_frame().unwrap();
// // Display updated frame // Set the EPD to sleep
// epd.display_frame()?; epd.sleep().unwrap();
// // Set the EPD to sleep
// epd.sleep()?;
loop {} loop {}
} }

Loading…
Cancel
Save