Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use state shift to simplify state transition #88

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
oops i forgor
Ragarnoy committed Nov 11, 2024
commit 31480c60493a71a6630864f30bad91ad3ae448d2
8 changes: 4 additions & 4 deletions src/detector/distance.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ pub mod results;

use crate::detector::distance::config::RadarDistanceConfig;
use crate::detector::distance::results::{DistanceSizes, ProcessDataError};
use crate::radar::{Radar, Ready};
use crate::radar::{Radar, RadarReady};
use crate::sensor::calibration::CalibrationResult;
use crate::sensor::error::SensorError;
use a121_sys::*;
@@ -48,7 +48,7 @@ where
DLY: DelayNs,
{
/// Reference to the radar system, configured and ready for operation.
pub radar: &'radar mut Radar<Ready, SINT, ENABLE, DLY>,
pub radar: &'radar mut Radar<SINT, ENABLE, DLY, RadarReady>,
inner: InnerRadarDistanceDetector,
/// Configuration for the radar distance detection.
pub config: RadarDistanceConfig,
@@ -61,7 +61,7 @@ where
DLY: DelayNs,
{
/// Constructs a new radar distance detector with default configuration.
pub fn new(radar: &'radar mut Radar<Ready, SINT, ENABLE, DLY>) -> Self {
pub fn new(radar: &'radar mut Radar<SINT, ENABLE, DLY, RadarReady>) -> Self {
let config = RadarDistanceConfig::default();
let inner = InnerRadarDistanceDetector::new(&config);
#[cfg(feature = "defmt")]
@@ -75,7 +75,7 @@ where

/// Constructs a new radar distance detector with the provided configuration.
pub fn with_config(
radar: &'radar mut Radar<Ready, SINT, ENABLE, DLY>,
radar: &'radar mut Radar<SINT, ENABLE, DLY, RadarReady>,
config: RadarDistanceConfig,
) -> Self {
let inner = InnerRadarDistanceDetector::new(&config);
8 changes: 4 additions & 4 deletions src/detector/presence.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ pub mod results;

use crate::detector::presence::config::PresenceConfig;
use crate::detector::presence::results::{PresenceMetadata, PresenceResult, ProcessDataError};
use crate::radar::{Radar, Ready};
use crate::radar::{Radar, RadarReady};
use crate::sensor::calibration::CalibrationResult;
use crate::sensor::error::SensorError;
use a121_sys::*;
@@ -54,7 +54,7 @@ where
ENABLE: OutputPin,
DLY: DelayNs,
{
pub radar: &'radar mut Radar<Ready, SINT, ENABLE, DLY>,
pub radar: &'radar mut Radar<SINT, ENABLE, DLY, RadarReady>,
inner: InnerPresenceDetector,
pub config: PresenceConfig,
}
@@ -65,7 +65,7 @@ where
ENABLE: OutputPin,
DLY: DelayNs,
{
pub fn new(radar: &'radar mut Radar<Ready, SINT, ENABLE, DLY>) -> Self {
pub fn new(radar: &'radar mut Radar<SINT, ENABLE, DLY, RadarReady>) -> Self {
let config = PresenceConfig::default();
let inner = InnerPresenceDetector::new(&config);
Self {
@@ -76,7 +76,7 @@ where
}

pub fn with_config(
radar: &'radar mut Radar<Ready, SINT, ENABLE, DLY>,
radar: &'radar mut Radar<SINT, ENABLE, DLY, RadarReady>,
config: PresenceConfig,
) -> Self {
let inner = InnerPresenceDetector::new(&config);