#embedded #embedded-hal #no-std #seeed #wio-terminal

no-std seeed-erpc

Driver crate for interacting with seeed-studio eRPC Wifi devices

4 releases

0.1.1 Dec 31, 2020
0.1.0 Dec 6, 2020
0.0.2 Dec 2, 2020
0.0.1 Dec 2, 2020

#385 in Embedded development

Download history 26/week @ 2021-02-25 11/week @ 2021-03-04 9/week @ 2021-03-11 28/week @ 2021-03-18 60/week @ 2021-03-25 25/week @ 2021-04-01 47/week @ 2021-04-08 40/week @ 2021-04-15 98/week @ 2021-04-22 146/week @ 2021-04-29 62/week @ 2021-05-06 88/week @ 2021-05-13 46/week @ 2021-05-20 59/week @ 2021-05-27 69/week @ 2021-06-03 132/week @ 2021-06-10

237 downloads per month
Used in wio_terminal

MIT/Apache

35KB
913 lines

seeed-erpc-rs

Crates.io usbd-hid

An embedded / no-std implementation of Seeed Studio's eRPC protocol, which is used to communicate with their RTL8720 firmware.

Most notably, this is the main firmware for the wifi chip in their Wio Terminal product.

WIP - most RPCs are not yet implemented.

Usage

Have a look at the Wio terminal BSP implementation for an example of how to use this.

To summarize:

  1. Generate the request bytes by combining the bytes generated by RPC::header(sequence_number) with the bytes extended from RPC::args(&mut buff).
  2. Transmit FrameHeader::new_from_msg(request_bytes) followed by request_bytes itself.
  3. Receive 4 bytes from the remote end (the frame header), and parse them using FrameHeader::parse().
  4. Receive the response payload by reading the next frame_header.msg_length bytes.
  5. Verify the CRC by calling frame_header.check_crc(&payload_bytes).
  6. Finally, get the result of the RPC by calling RPC::parse(&payload_bytes).

Handling 'callback' messages

Sometimes the remote end will send you data even if you didn't ask for it. These are the 'callback' service 'oneway' RPCs. Handling these is a little annoying. The trick is to repeat steps 3-6 above if you get the error Err::NotOurs back from RPC::parse().

Dependencies

~2MB
~35K SLoC