Update to released EG versions and fix some bugs
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -152,9 +152,11 @@ fn main() -> ! {
|
||||
|
||||
let mut cx = 20;
|
||||
let mut cy = 20;
|
||||
|
||||
let t = Text::new("Hello Rust!", Point::new(20, 16))
|
||||
.into_styled(TextStyle::new(Font6x8, BinaryColor::On));
|
||||
|
||||
|
||||
// Very brief delay before the loop, just to show how
|
||||
delay.delay_us(10_u8);
|
||||
|
||||
@@ -186,13 +188,13 @@ fn main() -> ! {
|
||||
.into_styled(TextStyle::new(Font6x8, BinaryColor::On));
|
||||
|
||||
display.clear();
|
||||
c.draw(&mut display);
|
||||
t.draw(&mut display);
|
||||
count.draw(&mut display);
|
||||
c.draw(&mut display).unwrap();
|
||||
t.draw(&mut display).unwrap();
|
||||
count.draw(&mut display).unwrap();
|
||||
display.flush().unwrap();
|
||||
|
||||
// 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
|
||||
cy += 1;
|
||||
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.enable_interrupt(exti);
|
||||
|
||||
CLK_PIN.borrow(cs).replace(Some(clk)).unwrap();
|
||||
DT_PIN.borrow(cs).replace(Some(dt)).unwrap();
|
||||
CLK_PIN.borrow(cs).replace(Some(clk));
|
||||
DT_PIN.borrow(cs).replace(Some(dt));
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user