From 102f60cbf69c8e4ff87a94886141b247b2c60547 Mon Sep 17 00:00:00 2001 From: hodasemi Date: Wed, 13 Mar 2024 20:43:03 +0100 Subject: [PATCH] Trying to fix clock divider --- src/dht.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dht.rs b/src/dht.rs index e8aa460..d37055b 100644 --- a/src/dht.rs +++ b/src/dht.rs @@ -1,6 +1,7 @@ use embassy_rp::pio::{Common, Config, Instance, PioPin, StateMachine}; use embassy_time::Timer; use fixed::traits::ToFixed; +use fixed_macro::types::U56F8; use pio_proc::pio_file; use crate::DhtError; @@ -25,7 +26,7 @@ impl<'d, PIO: Instance, const SM: usize> DhtPio<'d, PIO, SM> { config.set_set_pins(&[&pin]); config.set_in_pins(&[&pin]); config.shift_out.threshold = 32; - config.clock_divider = 125.to_fixed(); + config.clock_divider = (U56F8!(125_000_000) / 125).to_fixed(); sm.set_pin_dirs(embassy_rp::pio::Direction::Out, &[&pin]); sm.set_config(&config);