[][src]Struct nrf52_bin_logger::Logger

pub struct Logger<SEND, RECV> where
    SEND: Sender,
    RECV: Receiver
{ /* fields omitted */ }

A binary logging interface, using UARTE0.

In the future other serial interfaces might be supported

Methods

impl<RECV, T, BUFSZ> Logger<RealSender<T, BUFSZ>, RECV> where
    T: Serialize,
    BUFSZ: ArrayLength<u8>,
    RECV: Receiver + Default
[src]

pub fn log(&mut self, data: &str) -> Result<(), ()>[src]

Send a log level &str message

pub fn warn(&mut self, data: &str) -> Result<(), ()>[src]

Send a warn level &str message

pub fn error(&mut self, data: &str) -> Result<(), ()>[src]

Send an error level &str message

pub fn raw_bin(&mut self, description: &str, data: &[u8]) -> Result<(), ()>[src]

Send a byte slice message

pub fn data(&mut self, data: T) -> Result<(), ()>[src]

Send a log level &str message

impl<SEND, RECV> Logger<SEND, RECV> where
    SEND: Sender + Default,
    RECV: Receiver + Default
[src]

pub fn new(uart: Uarte<UARTE0>) -> Self[src]

impl<SEND, T, BUFSZ, MSGCT> Logger<SEND, RealReceiver<T, BUFSZ, MSGCT>> where
    T: DeserializeOwned,
    BUFSZ: ArrayLength<u8>,
    MSGCT: ArrayLength<T>,
    SEND: Sender + Default
[src]

pub fn start_receive(&mut self) -> Result<(), ()>[src]

Start the receive process using the internal double-buffers

pub fn get_pending_manual<'a, 'b>(
    &'b mut self,
    output: &'a mut [u8]
) -> Result<&'a mut [u8], ()>
[src]

Obtain any pending bytes in the active buffer. This also causes the internal double buffers to flip. When this function is successful, a sub-slice of output is returned, containing the read bytes.

Bytes are obtained as they are received on the line, so decoding and deserialization must be performed manually.

NOTE: Either this function or service_receive() must be polled periodically, or there will be data loss! In general, the calculation for "how often do I need to poll this" is 1 / (BAUDRATE / LINE_BITS_PER_DATA_BYTE / 255).

For example, at 230400 Baud, and 8N1 settings (8 data bits per 10 line bits), it is necessary to poll this function once per ~11ms.

pub fn service_receive(&mut self) -> Result<usize, ()>[src]

This is an automatic handler, that will clear any pending bytes, and attempt to parse any pending messages. If successful, the return value is the number messages ready to be cleared with get_msg().

NOTE: Either this function or get_pending_manual() must be polled periodically, or there will be data loss! In general, the calculation for "how often do I need to poll this" is 1 / (BAUDRATE / LINE_BITS_PER_DATA_BYTE / 255).

For example, at 230400 Baud, and 8N1 settings (8 data bits per 10 line bits), it is necessary to poll this function once per ~11ms.

Care must also be taken to ensure that MSGCT has a deep enough queue.

pub fn get_msg(&mut self) -> Option<T>[src]

Pop a single message off of the decoded/deserialized queue

Auto Trait Implementations

impl<SEND, RECV> Send for Logger<SEND, RECV> where
    RECV: Send,
    SEND: Send

impl<SEND, RECV> !Sync for Logger<SEND, RECV>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self