Bg77Hal

Struct Bg77Hal 

Source
pub struct Bg77Hal<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK>
where PIN0: OutputPin, PIN1: OutputPin, PIN2: OutputPin, TX: Write<u8>, RX: Read<u8>, CLOCK: Clock,
{ pub pin_enable: PIN0, pub pin_reset_n: PIN1, pub pin_pwrkey: PIN2, pub tx: TX, pub rx: RX, pub clock: &'a CLOCK, }
Expand description

Hardware abstraction for the BG77

  • pin_enable is used to physically power-up and power-down the modem, e.g. via a FET. If this feature should not be used, just mock the pin :)

  • pin_reset_n and pin_pwrkey correspond to the respective BG77 input pins. If those are inverted on your PCB (with an n-channel or npn transistor), do not forget to invert the software pins, too.

    Note: pin_pwrkey is referred to as just PWRKEY in the Quectel documentation although it is an active-low pin which is pulled up internally.

  • tx and rx correspond to the serial uart which connects to the BG77. It is advisable that rx is backed by a sufficiently large buffer because depending on your setting (MCU speed, optimization level, type of input buffering), data handling could be slower than the physical data transmission. If so, the input buffer will run quite full when receiving large chunks of data. Concretely: Choose an input buffer size of at least 1460 bytes plus safety margin, 1460 bytes is the biggest data chunk that can be received/read in a single AT command.

  • Timers at_timer and modem_timer for delays and timeouts

Fields§

§pin_enable: PIN0§pin_reset_n: PIN1§pin_pwrkey: PIN2§tx: TX§rx: RX§clock: &'a CLOCK

Implementations§

Source§

impl<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK> Bg77Hal<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK>
where PIN0: OutputPin, PIN1: OutputPin, PIN2: OutputPin, TX: Write<u8>, RX: Read<u8>, CLOCK: Clock,

Source

pub fn new( pin_enable: PIN0, pin_reset_n: PIN1, pin_pwrkey_n: PIN2, tx: TX, rx: RX, clock: &'a CLOCK, ) -> Self

Create a new BG77 hardware abstraction

Convenience method.

Auto Trait Implementations§

§

impl<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK> Freeze for Bg77Hal<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK>
where PIN0: Freeze, PIN1: Freeze, PIN2: Freeze, TX: Freeze, RX: Freeze,

§

impl<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK> RefUnwindSafe for Bg77Hal<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK>

§

impl<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK> Send for Bg77Hal<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK>
where PIN0: Send, PIN1: Send, PIN2: Send, TX: Send, RX: Send, CLOCK: Sync,

§

impl<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK> Sync for Bg77Hal<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK>
where PIN0: Sync, PIN1: Sync, PIN2: Sync, TX: Sync, RX: Sync, CLOCK: Sync,

§

impl<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK> Unpin for Bg77Hal<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK>
where PIN0: Unpin, PIN1: Unpin, PIN2: Unpin, TX: Unpin, RX: Unpin,

§

impl<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK> UnwindSafe for Bg77Hal<'a, PIN0, PIN1, PIN2, TX, RX, CLOCK>
where PIN0: UnwindSafe, PIN1: UnwindSafe, PIN2: UnwindSafe, TX: UnwindSafe, RX: UnwindSafe, CLOCK: RefUnwindSafe,

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.