[−][src]Struct deoxy::Pump
Represents a pump.
Notes
The pump is assumed to operate using an H-bridge, and so requires four pins.
We assume there's a single pump elsewhere in the architecture, although this code could be used to control multiple pumps concurrently.
Diagram
Here is a circuit diagram showing the meaning of each pin number. Each pin controls a relay/transistor in the H-bridge.
+-----+-----+
| 0 1
+V +-----+
| 2 3
+-----+-----+
Fields
invert: bool
Whether directions should be reversed.
Methods
impl Pump
[src]
pub fn try_new(pins: [u16; 4]) -> Result<Self, PinError>
[src]
Attempts to create a new pump using the given GPIO pin numbers.
pub fn new(pins: [u16; 4]) -> Self
[src]
Creates a new pump using the given GPIO pin numbers.
Panics
This method will panic if opening any of the pins fails. For a fallible initializer, see
Pump::try_new
.
pub fn set_direction<D>(
&mut self,
direction: D
) -> Result<Option<Direction>, PinError> where
D: Into<Option<Direction>>,
[src]
&mut self,
direction: D
) -> Result<Option<Direction>, PinError> where
D: Into<Option<Direction>>,
Changes the pump direction to the specified direction.
If the pump is not already stopped, it will be stopped and a wait of 20 ms will be added to prevent sparks, short-circuits, etc.
Notes
If invert
is true
, direction
will be inverted.
pub fn perfuse(&mut self) -> Result<Option<Direction>, PinError>
[src]
Switches the pump to the forward direction.
pub fn drain(&mut self) -> Result<Option<Direction>, PinError>
[src]
Switches the pump to the reverse direction.
pub fn stop(&mut self) -> Result<Option<Direction>, PinError>
[src]
Stops the pump.
pub fn is_stopped(&self) -> bool
[src]
Whether the pump is currently stopped.
Trait Implementations
impl Eq for Pump
[src]
impl PartialEq<Pump> for Pump
[src]
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Debug for Pump
[src]
impl Actor for Pump
[src]
type Context = Context<Self>
Actor execution context type
fn started(&mut self, ctx: &mut Self::Context)
Method is called when actor get polled first time.
fn stopping(&mut self, ctx: &mut Self::Context) -> Running
Method is called after an actor is in Actor::Stopping
state. There could be several reasons for stopping. Context::stop
get called by the actor itself. All addresses to current actor get dropped and no more evented objects left in the context. Read more
fn stopped(&mut self, ctx: &mut Self::Context)
Method is called after an actor is stopped, it can be used to perform any needed cleanup work or spawning more actors. This is final state, after this call actor get dropped. Read more
fn start(self) -> Addr<Self> where
Self: Actor<Context = Context<Self>>,
Self: Actor<Context = Context<Self>>,
Start new asynchronous actor, returns address of newly created actor. Read more
fn start_default() -> Addr<Self> where
Self: Actor<Context = Context<Self>> + Default,
Self: Actor<Context = Context<Self>> + Default,
Start new asynchronous actor, returns address of newly created actor.
fn create<F>(f: F) -> Addr<Self> where
F: FnOnce(&mut Context<Self>) -> Self + 'static,
Self: Actor<Context = Context<Self>>,
F: FnOnce(&mut Context<Self>) -> Self + 'static,
Self: Actor<Context = Context<Self>>,
Use create
method, if you need Context
object during actor initialization. Read more
impl Handler<Message> for Pump
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Erased for T
impl<Q, K> Equivalent for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> Same for T
type Output = T
Should always be Self