Technology Pricing Appstore Blog Docs Download

Luos Hardware Abstraction Layer

Luos library, Robus communication protocol, and physical bus

Luos can work on a single node or it can create a network for communication between containers located on different nodes. This communication should be defined and hardware-configured to fit with the chosen MCU. The files luos_hal.c and luos_hal.h define all the functions needed by the Luos library to send messages through the bus and create the initialization of all hardware MCU components. The file luos_hal_config.h file contains a default config for an MCU family and can be redefined in your project to fit with your design.

Luos HAL

Lists of all the functions using hardware components relative to protocol communication and physical bus:

  • CRC: Validates messages. CRC can be generated by hardware or software
  • PORT: Defines necessary pins, PTP lines, Rx/Tx, enable/disable
  • FLASH: Storing of containers' aliases in the system
  • TIMER: Defines timeouts for communications
  • COM: Serial bus

Luos HAL configuration

luos_hal_config.h defines a default configuration pinout, serial bus for a MCU Family.

Luos covers many Hardware Abstraction Layers for MCU Families, so you can choose the right one for your MCU. To match pinout and fonctionality with your design, you can create a file hardware_config.h in main.c, for example, and include the file in your project before including luos.h:

#include "hardware_config.h"
#include "luos.h"

int main(void)
    return 0;

This way you are able to predefine hardware configuration for Luos in the file hardware_config.h. For example, using USART3 in your design instead of USART1 defined by luos_hal_config.h is defined as followed:

#define COM_TX_PIN                  10
#define COM_TX_PORT                 GPIOA
#define COM_TX_AF                   GPIO_AF1_USART3

#define COM_RX_PIN                  11
#define COM_RX_PORT                 GPIOA
#define COM_RX_AF                   GPIO_AF1_USART3

#define LUOS_COM                    USART3
#define LUOS_COM_IRQ                USART3_IRQn
#define LUOS_COM_IRQHANDLER()       USART3_IRQHandler()

There are many possible configurations that you can change, not all of them being necessary for your design:

PORT_CLOCK_ENABLEActivates clock for GPIODepends on port
RX_EN_PIN/TX_EN_PINChooses pinout to activate Rx/Tx commsNecessary for special comms
COM_LVL_DOWN_PIN/COM_LVL_UP_PINChooses pinout to pull commsNecessary for special comms
COM_TX_PIN/COM_RX_PINChooses pinout for Rx/Tx commsAdapts to the chosen serial bus
PTPX_PIN/PTPX_IRQ/PINOUT_IRQHANDLERChooses pinout, IRQ and callback for the PTP lineNecessary for topology detection
LUOS_COM_CLOCK_ENABLEActivates clock for serialDepends on serial bus
LUOS_COM/LUOS_COM_IRQ/LUOS_COM_IRQHANDLERChoose serial bus, IRQ and callbackAdapt to the serial bus chosen
LUOS_TIMER_LOCK_ENABLEActivate clock for TimeoutNecessary for Timeout
LUOS_TIMER/LUOS_TIMER_IRQ/LUOS_TIMER_IRQHANDLERChoose Timer, IRQ and callbackNecessary for Timeout
PAGE_SIZE/ADRESS_LAST_PAGEDefines space in flash for aliasNecessary to rename container alias
Follow @Luos-io Watch Star