Update to released EG versions and fix some bugs
parent
3bcca9ff0b
commit
a498332a7c
|
@ -12,7 +12,7 @@ cortex-m-rt = "0.6.12"
|
||||||
panic-halt = "0.2.0"
|
panic-halt = "0.2.0"
|
||||||
embedded-hal = "0.2.3"
|
embedded-hal = "0.2.3"
|
||||||
nb = "0.1.2"
|
nb = "0.1.2"
|
||||||
ssd1306 = "0.3.0-alpha.4"
|
ssd1306 = "0.3.1"
|
||||||
switch-hal = "0.3.2"
|
switch-hal = "0.3.2"
|
||||||
|
|
||||||
[dependencies.arrayvec]
|
[dependencies.arrayvec]
|
||||||
|
@ -20,7 +20,7 @@ version = "0.5.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dependencies.embedded-graphics]
|
[dependencies.embedded-graphics]
|
||||||
version = "0.6.0-alpha.3"
|
version = "0.6.1"
|
||||||
|
|
||||||
[dependencies.stm32f1]
|
[dependencies.stm32f1]
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -152,9 +152,11 @@ fn main() -> ! {
|
||||||
|
|
||||||
let mut cx = 20;
|
let mut cx = 20;
|
||||||
let mut cy = 20;
|
let mut cy = 20;
|
||||||
|
|
||||||
let t = Text::new("Hello Rust!", Point::new(20, 16))
|
let t = Text::new("Hello Rust!", Point::new(20, 16))
|
||||||
.into_styled(TextStyle::new(Font6x8, BinaryColor::On));
|
.into_styled(TextStyle::new(Font6x8, BinaryColor::On));
|
||||||
|
|
||||||
|
|
||||||
// Very brief delay before the loop, just to show how
|
// Very brief delay before the loop, just to show how
|
||||||
delay.delay_us(10_u8);
|
delay.delay_us(10_u8);
|
||||||
|
|
||||||
|
@ -186,13 +188,13 @@ fn main() -> ! {
|
||||||
.into_styled(TextStyle::new(Font6x8, BinaryColor::On));
|
.into_styled(TextStyle::new(Font6x8, BinaryColor::On));
|
||||||
|
|
||||||
display.clear();
|
display.clear();
|
||||||
c.draw(&mut display);
|
c.draw(&mut display).unwrap();
|
||||||
t.draw(&mut display);
|
t.draw(&mut display).unwrap();
|
||||||
count.draw(&mut display);
|
count.draw(&mut display).unwrap();
|
||||||
display.flush().unwrap();
|
display.flush().unwrap();
|
||||||
|
|
||||||
// Control the horizontal position with the knob
|
// Control the horizontal position with the knob
|
||||||
cx = counter.min(0).max(DISPLAY_W);
|
cx = counter.max(C_RADIUS/2).min(DISPLAY_W-C_RADIUS/2);
|
||||||
// Wrap the ball back to the top when it falls off the bottom
|
// Wrap the ball back to the top when it falls off the bottom
|
||||||
cy += 1;
|
cy += 1;
|
||||||
if cy > (DISPLAY_H + C_RADIUS) { cy = -C_RADIUS };
|
if cy > (DISPLAY_H + C_RADIUS) { cy = -C_RADIUS };
|
||||||
|
@ -211,8 +213,8 @@ fn init_encoder_pins(
|
||||||
clk.trigger_on_edge(exti, Edge::RISING_FALLING);
|
clk.trigger_on_edge(exti, Edge::RISING_FALLING);
|
||||||
clk.enable_interrupt(exti);
|
clk.enable_interrupt(exti);
|
||||||
|
|
||||||
CLK_PIN.borrow(cs).replace(Some(clk)).unwrap();
|
CLK_PIN.borrow(cs).replace(Some(clk));
|
||||||
DT_PIN.borrow(cs).replace(Some(dt)).unwrap();
|
DT_PIN.borrow(cs).replace(Some(dt));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue