Code Monkey home page Code Monkey logo

wake-rs's Introduction

wake-rs

crates.io docs.rs MIT licensed

wake-rs is a library written in Rust for encoding/decoding Wake protocol.

Wake is a serial communication protocol highly optimized for microcontrollers. It based on SLIP protocol (https://datatracker.ietf.org/doc/html/rfc1055).

debug_print

Main features

  • unique start symbol
  • 7-bit addressing (optional)
  • CRC (8 or 16 bits)
  • low overhead

The protocol doesn't support:

  • error correction
  • compression

Frame structure:

Frame structure

Integrations

There are many architecture-specific implementations:

  • MCS-51
  • AVR
  • STM32
  • x86

in many languages:

  • C
  • C++
  • C#
  • Python
  • Rust

Examples

  1. Demo - basic usage
  2. Serial - how to use with serial port
  3. Relay shield - PC <-> device communication

Quick Start

Add to your Rust project:

cargo add systemd-wake

Create, encode and decode packet:

use wake_rs::{Decode, Encode};

fn main() {
    let wp = wake_rs::Packet {
        address: Some(0x12),
        command: 3,
        data: Some(vec![0x00, 0xeb]),
    };

    let encoded = wp.encode().unwrap();
    let decoded = encoded.decode();
}

Build library:

cargo build --release

Build examples:

cargo build --examples

Resources

Protocol description, libraries, and tools: http://www.leoniv.diod.club/articles/wake/wake.html

TODO

  • Use this library with a microcontroller (nostd)
  • Add a stream decoder (one byte per time with internal buffer)

License

Code released under the MIT License.

wake-rs's People

Contributors

ew1abz avatar vladimir-hbi avatar

Stargazers

nop avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.