Skip to content

Commit

Permalink
Fix examples and clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
9names committed Jan 11, 2024
1 parent f1fc3d5 commit 8be399f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![no_main]

use bl602_hal as hal;
use embedded_hal::delay::DelayUs;
use embedded_hal::delay::DelayNs;
use embedded_hal::digital::OutputPin;
use hal::{
clock::{Strict, SysclkFreq, UART_PLL_FREQ},
Expand Down
8 changes: 7 additions & 1 deletion examples/i2c_ssd1306.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use embedded_graphics::{
text::{Baseline, Text},
Drawable,
};
use embedded_hal::delay::DelayNs;

use hal::{
clock::{Strict, SysclkFreq, UART_PLL_FREQ},
pac,
Expand Down Expand Up @@ -57,5 +59,9 @@ fn main() -> ! {

display.flush().unwrap();

loop {}
// Create a blocking delay function based on the current cpu frequency
let mut d = bl602_hal::delay::McycleDelay::new(clocks.sysclk().0);
loop {
d.delay_ms(1000);
}
}
2 changes: 1 addition & 1 deletion examples/led_timer_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use bl602_hal as hal;
use core::cell::RefCell;
use core::ops::DerefMut;
use critical_section::{self, Mutex};
use embedded_hal::digital::{OutputPin, ToggleableOutputPin};
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
use embedded_hal_zero::timer::CountDown;
use embedded_time::{duration::*, rate::*};
use hal::{
Expand Down
2 changes: 1 addition & 1 deletion examples/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use bl602_hal as hal;
use core::fmt::Write;
use embedded_hal::delay::DelayUs;
use embedded_hal::delay::DelayNs;
use hal::{
clock::{Strict, SysclkFreq, UART_PLL_FREQ},
pac,
Expand Down
6 changes: 3 additions & 3 deletions examples/watchdog_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use core::cell::RefCell;
use core::fmt::Write;
use core::ops::DerefMut;
use critical_section::{self, Mutex};
use embedded_hal::delay::DelayUs;
use embedded_hal::digital::{OutputPin, ToggleableOutputPin};
use embedded_hal::delay::DelayNs;
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
use embedded_hal_zero::watchdog::{Watchdog, WatchdogEnable};
use embedded_time::{duration::*, rate::*};
use hal::{
Expand Down Expand Up @@ -152,7 +152,7 @@ fn Watchdog(_: &mut TrapFrame) {
// Toggle the red led whenever the interrupt is triggered:
critical_section::with(|cs| {
if let Some(led_pin) = G_INTERRUPT_LED_PIN_R.borrow(cs).borrow_mut().deref_mut() {
led_pin.toggle();
led_pin.toggle().unwrap();
}
});

Expand Down

0 comments on commit 8be399f

Please sign in to comment.