HAL  v0.8.0
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 178 120
hal_can.h 24 166 105
hal_modbus.h 25 183 88
hal_i2c.h 23 174 84
hal_qei.h 25 159 81
hal_spi.h 24 191 81
hal_adc.h 22 110 71
hal_rtc.h 23 152 71
hal_gpio.h 21 121 59
hal_nvm.h 20 152 54
hal_system.h 20 129 51
hal_dac.h 20 136 47
hal_timer.h 18 104 47
hal_pwm.h 21 136 46
hal_wdt.h 18 104 44
hal_delay.h 12 72 16
SUM 345 2267 1065

License

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