From 5b80530ba2a1c954eed6662b88d5251a38d72c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gro=C3=9F?= Date: Tue, 9 Oct 2018 14:41:26 +0200 Subject: [PATCH] Finished stm32f3disovery example. This example still needs to be tested on the board --- .travis.yml | 1 + examples/Readme.md | 6 ++- examples/stm32f3discovery/Cargo.toml | 2 +- examples/stm32f3discovery/src/main.rs | 60 ++++++++++++--------------- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90eda11..e802402 100644 --- a/.travis.yml +++ b/.travis.yml @@ -102,6 +102,7 @@ script: - cargo doc --all-features --release - cd examples/embedded_linux_epd4in2 && cargo check && cd ../../ - cd examples/embedded_linux_epd1in54 && cargo check && cd ../../ + - cd examples/stm32f3discovery && cargo check && cd ../../ #- cd ../f3_stm32f30x && cargo build after_success: diff --git a/examples/Readme.md b/examples/Readme.md index e84e70b..e303cf8 100644 --- a/examples/Readme.md +++ b/examples/Readme.md @@ -8,4 +8,8 @@ It showcases most of what can be done with the crate. ### embedded_linux_epd1in54 -This example doesn't use the graphics feature of the crate and shows the fast update rate of the 1in54 EPD. \ No newline at end of file +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! \ No newline at end of file diff --git a/examples/stm32f3discovery/Cargo.toml b/examples/stm32f3discovery/Cargo.toml index acbfd6e..faa1a10 100644 --- a/examples/stm32f3discovery/Cargo.toml +++ b/examples/stm32f3discovery/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "STM32F3DISCOVERY-EInk-Example" +name = "stm32_f3_discovery_eink_example" version = "0.1.0" authors = ["Christoph Groß "] diff --git a/examples/stm32f3discovery/src/main.rs b/examples/stm32f3discovery/src/main.rs index d826264..a8a4a72 100644 --- a/examples/stm32f3discovery/src/main.rs +++ b/examples/stm32f3discovery/src/main.rs @@ -73,7 +73,7 @@ fn main() -> ! { cs.set_high(); // // Configure Busy Input Pin - let mut busy = gpioe + let busy = gpioe .pe4 .into_floating_input(&mut gpioe.moder, &mut gpioe.pupdr); // .pe4 @@ -132,46 +132,40 @@ fn main() -> ! { // // 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 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 - // gyroscope and the temperature sensor readings - //asm::bkpt(); + - // // Clear the full screen - // epd.clear_frame(); - // epd.display_frame(); + // Clear the full screen + epd.clear_frame().unwrap(); + epd.display_frame().unwrap(); - // // Speeddemo - // let small_buffer = [Color::Black.get_byte_value(), 16 as u8 / 8 * 16 as u8]; - // 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)?; - // epd.display_frame()?; - // } + // Speeddemo + let small_buffer = [Color::Black.get_byte_value(), 16 as u8 / 8 * 16 as u8]; + 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(); + } - // // Clear the full screen - // epd.clear_frame(); - // epd.display_frame(); + // Clear the full screen + epd.clear_frame().unwrap(); + epd.display_frame().unwrap(); - // // Draw some squares - // let mut small_buffer = [Color::Black.get_byte_value(), 160 as u8 / 8 * 160 as u8]; - // epd.update_partial_frame(&small_buffer, 20, 20, 160, 160)?; + // Draw some squares + let mut small_buffer = [Color::Black.get_byte_value(), 160 as u8 / 8 * 160 as u8]; + epd.update_partial_frame(&small_buffer, 20, 20, 160, 160).unwrap(); - // small_buffer = [Color::White.get_byte_value(), 80 as u8 / 8 * 80 as u8]; - // epd.update_partial_frame(&small_buffer, 60, 60, 80, 80)?; + small_buffer = [Color::White.get_byte_value(), 80 as u8 / 8 * 80 as u8]; + epd.update_partial_frame(&small_buffer, 60, 60, 80, 80).unwrap(); - // small_buffer = [Color::Black.get_byte_value(), 8]; - // epd.update_partial_frame(&small_buffer, 96, 96, 8, 8)?; + small_buffer = [Color::Black.get_byte_value(), 8]; + epd.update_partial_frame(&small_buffer, 96, 96, 8, 8).unwrap(); - // // Display updated frame - // epd.display_frame()?; + // Display updated frame + epd.display_frame().unwrap(); - // // Set the EPD to sleep - // epd.sleep()?; + // Set the EPD to sleep + epd.sleep().unwrap(); loop {} }