This repository collects documentations and tools for the Little Less Protocol.
Please note Little Less Protocol is still under development there may be incompatible changes.
Little Less Protocol is a simple serial protocol for little microcontrollers. In comparison to other protocols Little Less Protocol uses less buffers and less states. Also you application not need full buffers but if you want to use them, they are owned by the application, so your application has the full control over it.
There is also a layer for basic protocol handling (Little Less Base) like check if there is the right communication participant and it uses a compatible version of the protocol. If you do not need such thinks you can omit this layer.
Because every project needs other data and commands to send you can design you individual protocol. Therefore you can use a YAML description. This description can be used by other tools e.g. to generate protocol documentation or even a code skeleton for your project.
The first implementation (under development but already usable):
Little Less Protocol for Arduino (develop)
More implementations will follow. If you want to implement Little Less Protocol you should read the Little Less Protocol specification
- Decide if Little Less Protocol is the right for your project
- Design you individual protocol
- Generate the protocol documentation
- Generate the code skeleton for your project
- Implement your project
Little Less Protocol may fit to your project if...
- you are looking for a serial protocol for small microcontroller
- less memory consumption is more important than a quickly programmed solution
- you can process received data in chunks or even byte for byte
- you want to envelop you project step by step and need a versionable protocol
- you need to care if both communication participants fit together
- you like design generated documentation and code
Little Less Protocol may not fit to your project if...
- your system have enough memory to handle all data at once
- Note: Little Less Protocol may still work but you may also find an easier to handle protocol
- you need a fixed API but can not wait till Little Less Protocol first released version
You can use the Chat protocol as base to design your individual protocol. Please read the Little Less Protocol YAML schema for more information.
To verify you can use yaml2x.py
. Therefore you need python3 with strictyaml and Jinja2.
On Linux just call the following commands to install all you need:
cd <PATH_TO_LITTLE_LESS_PROTOCOL_SUITE>
python3 -m venv env
source env/bin/activate
pip install strictyaml
pip install Jinja2
To verify just call:
./tools/yaml2x.py -i <PATH_TO_YOUR_YAML_FILE>
If there is no error output you yaml file is probably fine. Currently not all possible structural defects are tested.
You can use yaml2x.py
also to generate a markedown documentation.
On Linux just call:
./tools/yaml2x.py -a md -i <PATH_TO_YOUR_YAML_FILE> -o <NEW_MD_FILE>
Example output: Chat protocol
Currently only code for Arduino IDE can be generated.
Again use yaml2x.py
also to generate the code.
On Linux just call:
./tools/yaml2x.py -a ino -i <PATH_TO_YOUR_YAML_FILE> -o <NEW_INO_FILE>
You can also split the generated code into two files. One file for the code you don't need to touch and one file where you can add your logic.
./tools/yaml2x.py -a ino-main -i <PATH_TO_YOUR_YAML_FILE> -o <NEW_INO_MAIN_FILE>
./tools/yaml2x.py -a ino-extra -i <PATH_TO_YOUR_YAML_FILE> -o <NEW_INO_EXTRA_FILE>
You only need do edit <NEW_INO_MAIN_FILE>
.
Of course it is up to you to implement the application logic but some tips may follow here later.
Little Less Protocol Suite is distributed under the MIT License.