GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • mhaa-arch
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles

This view

  • Original page
  • New address

GeezerVison is showing github.com — Modular Hardware Abstraction Architecture

README.md

Modular Hardware Abstraction Architecture

Note

Looking for the Brazilian Portuguese version? Read it here.

Modular Hardware Abstraction Architecture (MHAA) is a C++ architectural study for embedded software. It explores a layered and modular approach to hardware abstraction and source-level portability across compatible microcontrollers.

The project studies how established architectural concepts, C++ templates, and interfaces with pure virtual functions can work together to create reusable peripheral APIs while keeping hardware-specific details explicit.

Objectives

  • Layered hardware abstraction: organize software from hardware-specific definitions and MCU adapters through Peripheral Contracts and reusable Core modules to application-level APIs.
  • Microcontroller compatibility: explore source-level portability between microcontrollers that provide compatible capabilities.
  • Reusable components: keep common peripheral functionality in independent Core modules with clearly defined Peripheral Contracts.
  • Hybrid C++ abstraction: combine templates and pure virtual interfaces, using compile-time specialization and runtime polymorphism where each is appropriate.
  • Clear dependencies: separate hardware-specific implementation from reusable functionality and make component composition explicit.

Architecture

graph TD
    APP[Application] --> COMPOSITION[MCU Composition Layer]
    COMPOSITION --> CORE[Core]
    COMPOSITION --> ADAPTER[MCU Adapter]
    CORE --> CONTRACT[Peripheral Contract]
    ADAPTER --> CONTRACT
    ADAPTER --> HW[Hardware Definitions]
Loading

Note

The arrows represent code dependencies, not a sequence of runtime steps. The Core and the MCU Adapter both depend on the same Peripheral Contract. The Peripheral Contract defines an abstraction boundary; it is not a separate object that every operation must pass through.

Components

Component Responsibility
Application Contains firmware logic and uses the available Core APIs.
MCU Composition Layer Acts as the Composition Root, selecting the target MCU, instantiating the required Core modules and MCU Adapters, and connecting their dependencies to compose the MCU interface exposed to the application.
Core Provides reusable peripheral operations without depending on MCU registers.
Peripheral Contract Defines the interface and expected behavior for a peripheral's implementations.
MCU Adapters Implement Peripheral Contracts for a specific microcontroller.
Hardware Definitions Describe hardware-specific registers, pins, mappings, and capabilities.

Design Foundations

MHAA combines six established architectural concepts:

Concept Role in MHAA
Layered Architecture Separates application logic, composition, reusable functionality, Peripheral Contracts, and hardware-specific code.
Ports and Adapters Uses Peripheral Contracts as ports and MCU-specific implementations as adapters.
SOLID Guides responsibility boundaries, interface design, substitutability, and dependency direction.
Hardware Abstraction Layer (HAL) Provides consistent APIs for hardware capabilities supported by each target.
Composition Root Places target MCU selection and dependency composition in the MCU Composition Layer.
Modular Architecture Organizes functionality into independent components, including separate Core and Peripheral Contract modules.

These are established practices. MHAA studies how they can be combined and applied to embedded C++ software.

Implementation and Validation

The project currently provides basic Core modules and their corresponding Peripheral Contracts for common peripheral capabilities. The current components focus on foundational functionality rather than complex peripheral features.

The next stage is to develop MCU-specific adapters and validate the architecture across the following targets:

  • ATmega328P
  • ATmega2560
  • STM32
  • RP2040
  • ESP32

Important

These are planned validation targets. Their inclusion does not mean that adapters or complete hardware support are already available.

Design Priorities

Architectural clarity and source-level portability guide the design.

MHAA explores a hybrid approach to C++ abstraction:

  • Templates provide compile-time specialization where it is useful.
  • Pure virtual interfaces define Peripheral Contracts and allow implementations to be substituted.
  • Core modules use these abstractions to keep reusable peripheral behavior independent of a specific MCU.

Memory usage and runtime overhead remain relevant design considerations. However, avoiding object-oriented design or virtual dispatch is not an absolute goal. The project evaluates these trade-offs in the context of clarity, modularity, and portability.

Pinned Loading

  1. gpio gpio Public

    MHAA core providing reusable operations for general purpose digital input and output.

    C++

  2. adc adc Public

    MHAA core providing reusable operations for analog to digital conversion.

    C++

  3. eeprom eeprom Public

    MHAA core providing reusable operations for EEPROM memory access.

    C++

  4. pwm pwm Public

    MHAA core providing reusable operations for pulse width modulation.

    C++

  5. serial serial Public

    MHAA core providing reusable operations for serial communication.

    C++

  6. timer timer Public

    MHAA core providing reusable operations for timer and counter management.

    C++

Repositories

Loading
Type
Language
Sort
Showing 10 of 31 repositories
  • .github Public

    Organization profile

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/.github's past year of commit activity
    0 0 0 0 Updated Nov 28, 2026
  • watchdog Public

    MHAA core providing reusable operations for watchdog timer management.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/watchdog's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
  • timer Public

    MHAA core providing reusable operations for timer and counter management.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/timer's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
  • spi Public

    MHAA core providing reusable operations for SPI communication.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/spi's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
  • serial Public

    MHAA core providing reusable operations for serial communication.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/serial's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
  • reset Public

    MHAA core providing reusable operations for reset management.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/reset's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
  • pwm Public

    MHAA core providing reusable operations for pulse width modulation.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/pwm's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
  • power Public

    MHAA core providing reusable operations for power and sleep management.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/power's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
  • interrupt Public

    MHAA core providing reusable operations for interrupt management.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/interrupt's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
  • i2c Public

    MHAA core providing reusable operations for I2C communication.

    Uh oh!

    There was an error while loading. Please reload this page.

    mhaa-arch/i2c's past year of commit activity
    C++ 0 MIT 0 0 0 Updated Nov 26, 2026
View all repositories

People

@DanielArndt0

Top languages

Loading…

Uh oh!

There was an error while loading. Please reload this page.

Most used topics

Loading…

Uh oh!

There was an error while loading. Please reload this page.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.