Struct Esp8266

Source
pub struct Esp8266<Tx, Rx, Timer, Rst>
where Tx: Write<u8>, Rx: Read<u8>, Timer: LongTimer, Rst: OutputPin,
{ /* private fields */ }
Expand description

Struct for interracting with an esp8266 wifi module over USART

Implementations§

Source§

impl<Tx, Rx, Timer, Rst> Esp8266<Tx, Rx, Timer, Rst>
where Tx: Write<u8>, Rx: Read<u8>, Timer: LongTimer, Rst: OutputPin,

Source

pub fn new( tx: Tx, rx: Rx, timer: Timer, chip_enable_pin: Rst, ) -> Result<Self, Error<Error<Rx::Error>, Tx::Error, Rst::Error>>

Sets up the esp8266 struct and configures the device for future use

tx and rx are the pins used for serial communication, timer is a hardware timer for dealing with things like serial timeout and chip_enable_pin is a pin which must be connected to the CHIP_EN pin of the device

Source

pub fn send_data( &mut self, connection_type: ConnectionType, address: &str, port: u16, data: &str, ) -> Result<(), TransmissionError<Error<Rx::Error>, Tx::Error, Rst::Error>>

Source

pub fn close_connection( &mut self, ) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>

Source

pub fn power_down( &mut self, ) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>

Turns off the device by setting chip_enable to 0

Source

pub fn reset( &mut self, ) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>

Resets the device by setting chip_enable to 0 and then back to 1

Source

pub fn power_up( &mut self, ) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>

Turns the device back on by setting chip_enable to high

Source

pub fn pull_some_current( &mut self, ) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>

Auto Trait Implementations§

§

impl<Tx, Rx, Timer, Rst> Freeze for Esp8266<Tx, Rx, Timer, Rst>
where Tx: Freeze, Rx: Freeze, Timer: Freeze, Rst: Freeze,

§

impl<Tx, Rx, Timer, Rst> RefUnwindSafe for Esp8266<Tx, Rx, Timer, Rst>

§

impl<Tx, Rx, Timer, Rst> Send for Esp8266<Tx, Rx, Timer, Rst>
where Tx: Send, Rx: Send, Timer: Send, Rst: Send,

§

impl<Tx, Rx, Timer, Rst> Sync for Esp8266<Tx, Rx, Timer, Rst>
where Tx: Sync, Rx: Sync, Timer: Sync, Rst: Sync,

§

impl<Tx, Rx, Timer, Rst> Unpin for Esp8266<Tx, Rx, Timer, Rst>
where Tx: Unpin, Rx: Unpin, Timer: Unpin, Rst: Unpin,

§

impl<Tx, Rx, Timer, Rst> UnwindSafe for Esp8266<Tx, Rx, Timer, Rst>
where Tx: UnwindSafe, Rx: UnwindSafe, Timer: UnwindSafe, Rst: UnwindSafe,

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.