Skip to main content
Version: 2.7.0

PlatformIO

What is PlatformIO?

PlatformIO is a user-friendly and extensible integrated development environment with a set of professional development instruments, compilers and debuggers. PlatformIO provides modern and powerful features to simplify the creation and delivery of embedded products. That is the reason why Luos uses PlatformIO's project structure for its examples, allowing users to use and share easily services and developments on a unified environment. Also, Luos engine and some tools like the gate or the inspector are available in the PlatformIO's registry. This registry allows users to link directly a project and a library, like Luos engine, by including dependencies in the configuration project file called platformio.ini. Learn more about PlatformIO and how to install it in VS Code .

PlatformIO's project structure

Every PlatformIO's project has a basic folder project structure and must have the file platformio.ini at the root of the project.

Checkout the Luos tutorial on how to create a Luos project with PlatformIO .

Luos configuration for platformio.ini

With PlatformIO, Luos libraries use scripts before compilation to select and include the code folder depending to your needs.

Configuration parameters need to be the same as the folder name you want to use. Some build_flags definition may be added to your platformio.ini file to configure these scripts.

Build flags examples:

build_flags =
-include node_config.h
-D GATEFORMAT=TinyJSON
-D LUOSHAL=STM32F0
-D PIPEMODE=SERIAL
-D PIPEHAL=NUCLEO-F0
lib_deps =
luos_engine
Gate
Pipe
caution

Every Luos project needs to have a node_config.h file allowing to configure the hardware dependencies and the libraries. See the basics concept page for more information.

A good configuration looks like this:

luos_imgluos_img

During the build, a message appearing in red means a problem has occurred, except for telemetry configuration (see next ).

Configuration for Luos engine Library

DefinitionDescriptionValueflag example
LUOSHALDefines the HAL family to use depending on your MCU. Luos engine HAL-D LUOSHAL=ATSAMD21_ARDUINO
NOTELEMETRYDisables telemetry.On by default-D NOTELEMETRY to disable telemetry
info

By default, the telemetry is enabled and sends anonymous information to Luos maintainers. This information is only used to improve Luos engine experience.

When telemetry message is appearing in red, this means it is disabled, but compilation will run properly.

For more information about telemetry, check the file source_filter_script.py.

Configuration for the gate

DefinitionDescriptionValueflag example
GATEFORMATChooses the format of data sent by the gate through a pipe.Available folder names .-D GATEFORMAT=TinyJSON
info

For more information about the gate configuration, check the file select_format_script.py.

Configuration for the pipe

DefinitionDescriptionValueflag example
PIPEMODEChooses the pipe style to send or receive information through a specific physical layer.Available folder names-D PIPEMODE=SERIAL
PIPEHALChooses the pipe HAL matched to a specific physical layer with the board.Available folder names on the selected PIPEMODE-D PIPEHAL=ARDUINO
info

For more information about the pipe configuration, check the file select_hal_script.py.