mirror of
https://github.com/esp-rs/esp-idf-hal.git
synced 2025-09-28 04:41:02 +00:00
Native delay API does not need self
This commit is contained in:
parent
f094e1c688
commit
83c1ebf4b7
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user