Struct bluerobotics_ping::bluebps::Device

source ·
pub struct Device {
    pub common: Common,
}

Fields§

§common: Common

Implementations§

source§

impl Device

source

pub fn new<T>(io: T) -> Self
where T: AsyncRead + AsyncWrite + Unpin + Send + 'static,

source

pub async fn set_lpf_sample_frequency( &self, sample_frequency: u32 ) -> Result<(), PingError>

the frequency to take adc samples and run the filter.

§Arguments
  • sample_frequency - sample frequency in Hz. 1~100000
source

pub async fn set_lpf_setting(&self, setting: u16) -> Result<(), PingError>

Low pass filter setting. This value represents x in the equation value = value * x + sample * (1-x). 0.0 = no filtering, 0.99 = heavy filtering.

§Arguments
  • setting - 0~999: x = 0~0.999
source

pub async fn set_temperature_max(&self, limit: u16) -> Result<(), PingError>

Set the maximum allowed battery temperature

§Arguments
  • limit [centidegrees Centigrade] - The maximum temperature allowed at the thermistor probe installed on the battery. 0~5000: 0~5V
source

pub async fn set_stream_rate(&self, rate: u32) -> Result<(), PingError>

Set the frequency to automatically output state messages.

§Arguments
  • rate [Hz] - Rate to stream state messages. 0~100000Hz
source

pub async fn cell_timeout(&self) -> Result<CellTimeoutStruct, PingError>

Get the undervoltage timeout

source

pub async fn reset_defaults(&self) -> Result<(), PingError>

Reset parameter configuration to default values.

§Arguments
source

pub async fn set_temperature_timeout( &self, timeout: u16 ) -> Result<(), PingError>

Set the over-temperature timeout

§Arguments
  • timeout [millisecond] - If the battery temperature exceeds the configured limit for this duration of time, the power will be locked-out
source

pub async fn temperature_timeout( &self ) -> Result<TemperatureTimeoutStruct, PingError>

Get the over-temperature timeout

source

pub async fn set_cell_voltage_timeout( &self, timeout: u16 ) -> Result<(), PingError>

Set the under-voltage timeout

§Arguments
  • timeout [millisecond] - If an individual cell exceeds the configured limit for this duration of time, the power will be locked-out
source

pub async fn set_current_timeout(&self, timeout: u16) -> Result<(), PingError>

Set the over-current timeout

§Arguments
  • timeout [millisecond] - If the battery current exceeds the configured limit for this duration of time, the power will be locked-out
source

pub async fn cell_voltage_min(&self) -> Result<CellVoltageMinStruct, PingError>

Get the minimum allowed cell voltage

source

pub async fn set_cell_voltage_minimum( &self, limit: u16 ) -> Result<(), PingError>

Set the minimum allowed cell voltage

§Arguments
  • limit [millivolt] - The minimum voltage allowed for any individual cell. 0~5000: 0~5V
source

pub async fn set_current_max(&self, limit: u16) -> Result<(), PingError>

Set the maximum allowed battery current

§Arguments
  • limit [centiampere] - The maximum allowed battery current 0~20000 = 0~200A
source

pub async fn reboot(&self, goto_bootloader: u8) -> Result<(), PingError>

reboot the system

§Arguments
  • goto_bootloader - 0 = normal reboot, run main application after reboot 1 = hold the device in bootloader after reboot
source

pub async fn current_max(&self) -> Result<CurrentMaxStruct, PingError>

get the maximum allowed battery current

source

pub async fn state(&self) -> Result<StateStruct, PingError>

Get the current state of the device

source

pub async fn events(&self) -> Result<EventsStruct, PingError>

A record of events causing a power lock-out. These numbers are non-volatile and reset only with the erase_flash control message.

source

pub async fn temperature_max(&self) -> Result<TemperatureMaxStruct, PingError>

Get the maximum allowed battery temperature

source

pub async fn current_timeout(&self) -> Result<CurrentTimeoutStruct, PingError>

Get the over-current timeout

source

pub async fn erase_flash(&self) -> Result<(), PingError>

Erase flash, including parameter configuration and event counters. The mcu has a limited number of write/erase cycles (1k)!

§Arguments

Trait Implementations§

source§

impl PingDevice for Device

source§

fn get_common(&self) -> &Common

source§

fn get_mut_common(&mut self) -> &mut Common

source§

fn subscribe(&self) -> Receiver<ProtocolMessage>

source§

async fn send_general_request(&self, requested_id: u16) -> Result<(), PingError>

source§

async fn wait_for_message<T>( &self, receiver: Receiver<ProtocolMessage> ) -> Result<T, PingError>
where T: MessageInfo + Sync + Clone + Send + 'static,

source§

async fn wait_for_ack( &self, receiver: Receiver<ProtocolMessage>, message_id: u16 ) -> Result<(), PingError>

source§

async fn request<T>(&self) -> Result<T, PingError>
where T: MessageInfo + Sync + Clone + Send + 'static,

source§

async fn device_information(&self) -> Result<DeviceInformationStruct, PingError>

Device information
source§

async fn protocol_version(&self) -> Result<ProtocolVersionStruct, PingError>

The protocol version
source§

async fn set_device_id(&self, device_id: u8) -> Result<(), PingError>

Set the device ID. Read more

Auto Trait Implementations§

§

impl Freeze for Device

§

impl !RefUnwindSafe for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl !UnwindSafe for Device

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more