Struct RadarConfig

Source
pub struct RadarConfig { /* private fields */ }
Expand description

Radar configuration structure to manage the settings of a radar sensor.

Implementations§

Source§

impl RadarConfig

Source

pub fn new() -> Self

Creates a new radar configuration instance with a specified ID.

Source

pub unsafe fn mut_ptr(&mut self) -> *mut acc_config_t

Returns a mutable pointer to the internal radar configuration structure

§Safety

This function is unsafe because it returns a raw pointer.

Source

pub fn ptr(&self) -> *const acc_config_t

Returns a pointer to the internal radar configuration structure

Source

pub fn set_sweep_mode( &mut self, sweep_mode: SweepMode, ) -> Result<(), ConfigError>

Sets the sweep mode for the radar sensor

§Arguments
  • sweep_mode - The sweep mode to set
Source

pub fn set_start_point(&mut self, start_point: i32)

Sets the starting point of the sweep.

§Arguments
  • start_point - The starting point of the sweep in millimeters.
Source

pub fn start_point(&self) -> i32

Get the starting point of the sweep.

Source

pub fn set_num_points(&mut self, num_points: u16)

Set the number of data points to measure in a sweep.

§Arguments
  • num_points - Number of data points to measure.
Source

pub fn num_points(&self) -> u16

Get the number of data points set to measure in a sweep.

Source

pub fn set_step_length(&mut self, step_length: u16)

Set the step length between each data point in a sweep.

§Arguments
  • step_length - The step length.
Source

pub fn step_length(&self) -> u16

Get the current step length between each data point in a sweep.

Source

pub fn set_profile(&mut self, profile: RadarProfile)

Set the radar profile.

§Arguments
  • profile - The radar profile to set.
Source

pub fn profile(&self) -> RadarProfile

Get the currently used radar profile

Source

pub fn set_hwaas(&mut self, hwaas: Hwaas) -> Result<(), ConfigError>

Set the hardware accelerated average samples (HWAAS).

Each data point can be sampled several times, and the sensor hardware produces an average value of those samples. The time needed to measure a sweep is roughly proportional to the number of averaged samples. Decreasing HWAAS can increase the update rate but may lead to lower SNR.

HWAAS must be between 1 and 511 inclusive.

§Arguments
  • hwaas - Number of hardware accelerated average samples.
Source

pub fn hwaas(&self) -> Hwaas

Get the hardware accelerated average samples (HWAAS).

Returns the number of hardware accelerated average samples currently set.

Source

pub fn receiver_gain_set(&mut self, receiver_gain: u8)

Set the receiver gain setting.

Must be a value between 0 and 23 inclusive where 23 is the highest gain and 0 the lowest. Lower gain gives higher SNR. However, too low gain may result in quantization, lowering SNR. Too high gain may result in saturation, corrupting the data.

§Arguments
  • receiver_gain - Receiver gain setting.
Source

pub fn receiver_gain(&self) -> u8

Get the current receiver gain setting.

Returns the receiver gain setting. The range is between 0 (lowest gain) and 23 (highest gain).

Source

pub fn set_sweeps_per_frame(&mut self, sweeps_per_frame: u16)

Set the number of sweeps captured in each frame (measurement).

§Arguments
  • sweeps_per_frame - Number of sweeps per frame.
Source

pub fn sweeps_per_frame(&self) -> u16

Get the number of sweeps captured in each frame (measurement).

Source

pub fn set_prf(&mut self, prf: PulseRepetitionFrequency)

Set the Pulse Repetition Frequency (PRF)

See @ref acc_config_prf_t for details.

§Arguments
  • prf - The Pulse Repetition Frequency to use
Source

pub fn prf(&self) -> PulseRepetitionFrequency

Get the Pulse Repetition Frequency

Returns the currently set Pulse Repetition Frequency.

Source

pub fn set_phase_enhancement(&mut self, enable: bool)

Enable or disable phase enhancement

If enabled, the data phase will be enhanced such that coherent distance filtering can be applied.

§Arguments
  • enable - true to enable phase enhancement, false to disable
Source

pub fn is_phase_enhancement_enabled(&self) -> bool

Check if phase enhancement is enabled

Returns true if phase enhancement is enabled.

Source

pub fn set_loopback(&mut self, enable: bool)

Enable or disable loopback

Loopback can’t be enabled together with profile 2.

§Arguments
  • enable - true to enable loopback, false otherwise
Source

pub fn is_loopback_enabled(&self) -> bool

Get the enable loopback configuration

Returns true if loopback is enabled.

Source

pub fn set_double_buffering(&mut self, enable: bool)

Enable or disable double buffering

If enabled, the sensor buffer will be split in two halves reducing the maximum number of samples.

§Arguments
  • enable - true to enable double buffering, false otherwise
Source

pub fn is_double_buffering_enabled(&self) -> bool

Get the double buffering configuration

Returns true if double buffering is enabled.

Source

pub fn set_frame_rate(&mut self, frame_rate: FrameRate)

Set the frame rate

Sets the frame rate.

§Arguments
  • frame_rate - Frame rate in Hz. 0 is interpreted as unlimited
Source

pub fn frame_rate(&self) -> FrameRate

Get the frame rate

Returns the currently set frame rate in Hz.

Source

pub fn set_transmitter_enabled(&mut self, enable: bool)

Enable or disable the transmitter

§Arguments
  • enable - true to enable the transmitter, false to disable it
Source

pub fn is_transmitter_enabled(&self) -> bool

Get transmitter enable configuration

Returns true if the transmitter is enabled.

Source

pub fn set_inter_frame_idle_state(&mut self, idle_state: RadarIdleState)

Set inter frame idle state

§Arguments
  • idle_state - The idle state to use between frames
Source

pub fn inter_frame_idle_state(&self) -> RadarIdleState

Get inter frame idle state

Returns the currently set idle state used between frames.

Source

pub fn set_inter_sweep_idle_state(&mut self, idle_state: RadarIdleState)

Set inter sweep idle state

§Arguments
  • idle_state - The idle state to use between sweeps within a frame
Source

pub fn inter_sweep_idle_state(&self) -> RadarIdleState

Get inter sweep idle state

Returns the currently set idle state used between sweeps within a frame.

Source

pub fn is_continuous_sweep_mode_enabled(&self) -> bool

Get continuous sweep mode

Returns true if continuous sweep mode is enabled.

Source

pub fn sweep_rate(&self) -> f32

Get the sweep rate

Returns the currently set sweep rate in Hz.

Source

pub fn set_num_subsweep(&mut self, num_subsweep: u8) -> Result<(), ConfigError>

Set the number of subsweeps in the radar configuration.

§Arguments
  • num_subsweep - The number of subsweeps to set
Source

pub fn num_subsweep(&self) -> u8

Get the number of subsweeps in the radar configuration.

Source

pub fn get_subsweep(&self, index: u8) -> Option<Subsweep>

Get a subsweep from the radar configuration.

§Arguments
  • index - The index of the subsweep to get
§Returns
  • Some(Subsweep) - The subsweep at the given index
  • None - If the index is out of bounds
Source

pub fn config_buffer_size(&self) -> Result<u32, ConfigError>

Get the buffer size needed for the current configuration

§Returns
  • Ok(u32) - The buffer size needed for the current configuration
  • Err(ConfigError::BufferSize) - If the buffer size could not be determined

Trait Implementations§

Source§

impl Debug for RadarConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RadarConfig

Source§

fn default() -> Self

Provides a default instance of RadarConfig with an ID of 1.

Source§

impl Drop for RadarConfig

Source§

fn drop(&mut self)

Destroys the radar configuration instance, freeing any allocated resources.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.