Native delay API does not need self

This commit is contained in:
ivmarkov 2022-09-25 12:00:51 +03:00
parent f094e1c688
commit 83c1ebf4b7
2 changed files with 2 additions and 7 deletions

View File

@ -9,11 +9,6 @@
//! For this example you need to hook up an SSD1306 I2C display.
//! The display will flash black and white.
use std::thread;
use std::time::Duration;
use embedded_hal::i2c::blocking::I2c;
use esp_idf_hal::delay::{FreeRtos, BLOCK};
use esp_idf_hal::i2c::*;
use esp_idf_hal::peripherals::Peripherals;

View File

@ -133,13 +133,13 @@ impl embedded_hal::delay::blocking::DelayUs for Ets {
pub struct FreeRtos;
impl FreeRtos {
fn delay_us(us: u32) {
pub fn delay_us(us: u32) {
let ms = us / 1000;
Self::delay_ms(ms);
}
fn delay_ms(ms: u32) {
pub fn delay_ms(ms: u32) {
// divide by tick length, rounding up
let ticks = ms.saturating_add(portTICK_PERIOD_MS - 1) / portTICK_PERIOD_MS;