pub struct Esp8266<Tx, Rx, Timer, Rst>{ /* 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>
impl<Tx, Rx, Timer, Rst> Esp8266<Tx, Rx, Timer, Rst>
Sourcepub fn new(
tx: Tx,
rx: Rx,
timer: Timer,
chip_enable_pin: Rst,
) -> Result<Self, Error<Error<Rx::Error>, Tx::Error, Rst::Error>>
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
pub fn send_data( &mut self, connection_type: ConnectionType, address: &str, port: u16, data: &str, ) -> Result<(), TransmissionError<Error<Rx::Error>, Tx::Error, Rst::Error>>
pub fn close_connection( &mut self, ) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>
Sourcepub fn power_down(
&mut self,
) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>
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
Sourcepub fn reset(
&mut self,
) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>
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
Sourcepub fn power_up(
&mut self,
) -> Result<(), Error<Error<Rx::Error>, Tx::Error, Rst::Error>>
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
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>
impl<Tx, Rx, Timer, Rst> RefUnwindSafe for Esp8266<Tx, Rx, Timer, Rst>
impl<Tx, Rx, Timer, Rst> Send for Esp8266<Tx, Rx, Timer, Rst>
impl<Tx, Rx, Timer, Rst> Sync for Esp8266<Tx, Rx, Timer, Rst>
impl<Tx, Rx, Timer, Rst> Unpin for Esp8266<Tx, Rx, Timer, Rst>
impl<Tx, Rx, Timer, Rst> UnwindSafe for Esp8266<Tx, Rx, Timer, Rst>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more