From 6446310023be889dff311cfdb3269e112512c9a8 Mon Sep 17 00:00:00 2001 From: Yandrik Date: Mon, 18 Nov 2024 16:34:44 +0100 Subject: [PATCH] feat(profiler-display): add std feature --- embedded-graphics-profiler-display/Cargo.toml | 3 +++ embedded-graphics-profiler-display/src/lib.rs | 2 +- embedded-graphics-profiler-display/src/profiler/mod.rs | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/embedded-graphics-profiler-display/Cargo.toml b/embedded-graphics-profiler-display/Cargo.toml index 78754ca..f0b49d6 100644 --- a/embedded-graphics-profiler-display/Cargo.toml +++ b/embedded-graphics-profiler-display/Cargo.toml @@ -3,6 +3,9 @@ name = "embedded-graphics-profiler-display" version = "0.1.0" edition = "2021" +[features] +std = [] + [dependencies] atomic = "0.6.0" embassy-time = "0.3.2" diff --git a/embedded-graphics-profiler-display/src/lib.rs b/embedded-graphics-profiler-display/src/lib.rs index 42b896f..76270d8 100644 --- a/embedded-graphics-profiler-display/src/lib.rs +++ b/embedded-graphics-profiler-display/src/lib.rs @@ -1,4 +1,4 @@ -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] #![no_main] mod profiler; diff --git a/embedded-graphics-profiler-display/src/profiler/mod.rs b/embedded-graphics-profiler-display/src/profiler/mod.rs index d5715bc..39ee007 100644 --- a/embedded-graphics-profiler-display/src/profiler/mod.rs +++ b/embedded-graphics-profiler-display/src/profiler/mod.rs @@ -1,4 +1,7 @@ use atomic::Atomic; +#[cfg(feature = "std")] +use std::time::{Duration, Instant}; +#[cfg(not(feature = "std"))] use embassy_time::{Duration, Instant}; use embedded_graphics::draw_target::DrawTarget; use embedded_graphics::{Drawable, Pixel};