HAL  v0.6.1
Hardware Abstraction Layer
Loading...
Searching...
No Matches
Hardware Abstraction Layer (HAL)

Hardware Abstraction Layer (HAL) provides a platform-agnostic interface, abstracting peripheral interactions from specific hardware implementations. This promotes code reusability, scalability, and maintainability in embedded software development.

Overview

Folder Structure

Each peripheral shall follow this example directory structure.

.
├── adc
│ ├── doc -------------------------------- Software design documentation
│ │ ├── hal-adc-class-diagram.puml
│ │ ├── hal-adc-sequence-diagram.puml
| │ └── images ------------------------- Software design images
│ └── public_inc
│ └── hal_adc.h ---------------------- Public interface
├── can
├── dac
├── delay
├── doc
│ ├── doxygen
│ ├── images
│ └── README.md -------------------------- Internal documentation
├── gpio
├── i2c
├── modbus
├── nvm
├── pwm
├── qei
├── README.md ------------------------------ This file
├── rtc
├── spi
├── system
├── timer
├── uart
└── wdt

Software

Software Design

Software design document available in the doc/ folder of each peripheral device. Each peripheral should have at least one class diagram and one sequence diagram illustrating the inputs and outputs expected for normal operation when using the interface.

The following example shows the GPIO class and sequence diagram,

GPIO Class Diagram
GPIO Sequence Diagram

Line of Code (LOC)

The total number of lines of code (LOC) for the header files.

File Blank Comment Code
hal_uart.h 29 162 120
hal_can.h 24 150 105
hal_modbus.h 25 167 88
hal_i2c.h 23 158 84
hal_qei.h 25 143 81
hal_spi.h 24 166 80
hal_adc.h 22 94 71
hal_rtc.h 23 136 71
hal_gpio.h 21 105 59
hal_nvm.h 20 136 54
hal_dac.h 20 120 47
hal_timer.h 18 88 47
hal_pwm.h 21 120 46
hal_wdt.h 18 88 44
hal_system.h 17 94 36
hal_delay.h 12 56 16
SUM 342 1983 1049

License

Copyright (c) 2024 by TH Muda Engineering. All rights reserved.