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)
{
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:
Function | Description | Comments |
---|---|---|
PORT_CLOCK_ENABLE | Activates clock for GPIO | Depends on port |
RX_EN_PIN/TX_EN_PIN | Chooses pinout to activate Rx/Tx comms | Necessary for special comms |
COM_LVL_DOWN_PIN/COM_LVL_UP_PIN | Chooses pinout to pull comms | Necessary for special comms |
COM_TX_PIN/COM_RX_PIN | Chooses pinout for Rx/Tx comms | Adapts to the chosen serial bus |
PTPX_PIN/PTPX_IRQ/PINOUT_IRQHANDLER | Chooses pinout, IRQ and callback for the PTP line | Necessary for topology detection |
LUOS_COM_CLOCK_ENABLE | Activates clock for serial | Depends on serial bus |
LUOS_COM/LUOS_COM_IRQ/LUOS_COM_IRQHANDLER | Choose serial bus, IRQ and callback | Adapt to the serial bus chosen |
LUOS_TIMER_LOCK_ENABLE | Activate clock for Timeout | Necessary for Timeout |
LUOS_TIMER/LUOS_TIMER_IRQ/LUOS_TIMER_IRQHANDLER | Choose Timer, IRQ and callback | Necessary for Timeout |
PAGE_SIZE/ADRESS_LAST_PAGE | Defines space in flash for alias | Necessary to rename container alias |