Is Luos for me? 🤔
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:

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

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)
{
    Luos_Init();
    Container_Init();
    while(1)
    {
        Luos_Loop();
        Container_Loop();
    }
    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_CLOCK_ENABLE()     __HAL_RCC_USART3_CLK_ENABLE()
#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:

Pinout

FunctionDescriptionComments
PORT_CLOCK_ENABLEActivates clock for GPIODepends on port
RX_EN_PIN/TX_EN_PINChooses pinout to activate Rx/Tx 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

Communication

FunctionDescriptionComments
LUOS_COM_CLOCK_ENABLEActivates clock for serialDepends on serial bus
LUOS_COM/LUOS_COM_IRQ/LUOS_COM_IRQHANDLERChooses serial bus, IRQ and callbackAdapts to the serial bus chosen
LUOS_DMA_CLOCK_ENABLEActivates clock for DMANecessary for for Tx
LUOS_DMA_CHANNELChooses ChannelSend Tx

Timer

FunctionDescriptionComments
LUOS_TIMER_CLOCK_ENABLEActivates clock for TimeoutNecessary for Timeout
LUOS_TIMER/LUOS_TIMER_IRQ/LUOS_TIMER_IRQHANDLERChooses Timer, IRQ and callbackNecessary for Timeout

Flash

FunctionDescriptionComments
PAGE_SIZE/ADRESS_LAST_PAGEDefines space in flash for aliasNecessary to rename container alias
Follow @Luos-io Watch Star