Struct bluerobotics_ping::ping1d::Device
source · pub struct Device {
pub common: Common,
}Fields§
§common: CommonImplementations§
source§impl Device
impl Device
pub fn new<T>(io: T) -> Self
sourcepub async fn set_device_id(&self, device_id: u8) -> Result<(), PingError>
pub async fn set_device_id(&self, device_id: u8) -> Result<(), PingError>
Set the device ID.
§Arguments
device_id- Device ID (0-254). 255 is reserved for broadcast messages.
sourcepub async fn speed_of_sound(&self) -> Result<SpeedOfSoundStruct, PingError>
pub async fn speed_of_sound(&self) -> Result<SpeedOfSoundStruct, PingError>
The speed of sound used for distance calculations.
sourcepub async fn ping_enable(&self) -> Result<PingEnableStruct, PingError>
pub async fn ping_enable(&self) -> Result<PingEnableStruct, PingError>
Acoustic output enabled state.
sourcepub async fn transmit_duration(
&self
) -> Result<TransmitDurationStruct, PingError>
pub async fn transmit_duration( &self ) -> Result<TransmitDurationStruct, PingError>
The duration of the acoustic activation/transmission.
sourcepub async fn set_speed_of_sound(
&self,
speed_of_sound: u32
) -> Result<(), PingError>
pub async fn set_speed_of_sound( &self, speed_of_sound: u32 ) -> Result<(), PingError>
Set the speed of sound used for distance calculations.
§Arguments
speed_of_sound[mm/s] - The speed of sound in the measurement medium. ~1,500,000 mm/s for water.
sourcepub async fn set_gain_setting(&self, gain_setting: u8) -> Result<(), PingError>
pub async fn set_gain_setting(&self, gain_setting: u8) -> Result<(), PingError>
Set the current gain setting.
§Arguments
gain_setting- The current gain setting. 0: 0.6, 1: 1.8, 2: 5.5, 3: 12.9, 4: 30.2, 5: 66.1, 6: 144
sourcepub async fn firmware_version(&self) -> Result<FirmwareVersionStruct, PingError>
pub async fn firmware_version(&self) -> Result<FirmwareVersionStruct, PingError>
Device information
sourcepub async fn pcb_temperature(&self) -> Result<PcbTemperatureStruct, PingError>
pub async fn pcb_temperature(&self) -> Result<PcbTemperatureStruct, PingError>
Temperature of the on-board thermistor.
sourcepub async fn distance(&self) -> Result<DistanceStruct, PingError>
pub async fn distance(&self) -> Result<DistanceStruct, PingError>
The distance to target with confidence estimate. Relevant device parameters during the measurement are also provided.
sourcepub async fn range(&self) -> Result<RangeStruct, PingError>
pub async fn range(&self) -> Result<RangeStruct, PingError>
The scan range for acoustic measurements. Measurements returned by the device will lie in the range (scan_start, scan_start + scan_length).
sourcepub async fn set_mode_auto(&self, mode_auto: u8) -> Result<(), PingError>
pub async fn set_mode_auto(&self, mode_auto: u8) -> Result<(), PingError>
Set automatic or manual mode. Manual mode allows for manual selection of the gain and scan range.
§Arguments
mode_auto- 0: manual mode. 1: auto mode.
sourcepub async fn distance_simple(&self) -> Result<DistanceSimpleStruct, PingError>
pub async fn distance_simple(&self) -> Result<DistanceSimpleStruct, PingError>
The distance to target with confidence estimate.
sourcepub async fn goto_bootloader(&self) -> Result<(), PingError>
pub async fn goto_bootloader(&self) -> Result<(), PingError>
Send the device into the bootloader. This is useful for firmware updates.
§Arguments
sourcepub async fn voltage_5(&self) -> Result<Voltage5Struct, PingError>
pub async fn voltage_5(&self) -> Result<Voltage5Struct, PingError>
The 5V rail voltage.
sourcepub async fn device_id(&self) -> Result<DeviceIdStruct, PingError>
pub async fn device_id(&self) -> Result<DeviceIdStruct, PingError>
The device ID.
sourcepub async fn continuous_start(&self, id: u16) -> Result<(), PingError>
pub async fn continuous_start(&self, id: u16) -> Result<(), PingError>
Command to initiate continuous data stream of profile messages.
§Arguments
id- The message id to stream. 1300: profile
sourcepub async fn profile(&self) -> Result<ProfileStruct, PingError>
pub async fn profile(&self) -> Result<ProfileStruct, PingError>
A profile produced from a single acoustic measurement. The data returned is an array of response strength at even intervals across the scan region. The scan region is defined as the region between <scan_start> and <scan_start + scan_length> millimeters away from the transducer. A distance measurement to the target is also provided.
sourcepub async fn set_ping_interval(
&self,
ping_interval: u16
) -> Result<(), PingError>
pub async fn set_ping_interval( &self, ping_interval: u16 ) -> Result<(), PingError>
The interval between acoustic measurements.
§Arguments
ping_interval[ms] - The interval between acoustic measurements.
sourcepub async fn continuous_stop(&self, id: u16) -> Result<(), PingError>
pub async fn continuous_stop(&self, id: u16) -> Result<(), PingError>
Command to stop the continuous data stream of profile messages.
§Arguments
id- The message id to stop streaming. 1300: profile
sourcepub async fn set_range(
&self,
scan_start: u32,
scan_length: u32
) -> Result<(), PingError>
pub async fn set_range( &self, scan_start: u32, scan_length: u32 ) -> Result<(), PingError>
Set the scan range for acoustic measurements.
§Arguments
scan_start[mm] - Not documentedscan_length[mm] - The length of the scan range. Minimum 1000.
sourcepub async fn general_info(&self) -> Result<GeneralInfoStruct, PingError>
pub async fn general_info(&self) -> Result<GeneralInfoStruct, PingError>
General information.
sourcepub async fn mode_auto(&self) -> Result<ModeAutoStruct, PingError>
pub async fn mode_auto(&self) -> Result<ModeAutoStruct, PingError>
The current operating mode of the device. Manual mode allows for manual selection of the gain and scan range.
sourcepub async fn processor_temperature(
&self
) -> Result<ProcessorTemperatureStruct, PingError>
pub async fn processor_temperature( &self ) -> Result<ProcessorTemperatureStruct, PingError>
Temperature of the device cpu.
sourcepub async fn gain_setting(&self) -> Result<GainSettingStruct, PingError>
pub async fn gain_setting(&self) -> Result<GainSettingStruct, PingError>
The current gain setting.
sourcepub async fn ping_interval(&self) -> Result<PingIntervalStruct, PingError>
pub async fn ping_interval(&self) -> Result<PingIntervalStruct, PingError>
The interval between acoustic measurements.