|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Abstract pin-driver interface for dependency injection. More...
Go to the source code of this file.
Data Structures | |
| struct | ra8_pin_interface_t |
| Vtable for a pin driver. More... | |
Abstract pin-driver interface for dependency injection.
Drivers that need to toggle a GPIO pin (LED blinkers, motor enables, nFAULT inputs, chip-select lines) should not call ra8_gpio_* directly in production code – that couples them to the real hardware and prevents unit testing. Instead they take an ra8_pin_interface_t pointer:
In production pin_if points at g_ra8_gpio_pin_interface (defined in libs/ra8_hal/src/gpio.c). In tests it points at a mock that records every call.
This is the "Dependency Inversion" D of SOLID. NASA Power of 10 Rule 9 nominally bans function pointers, but this project makes the DI exception called out in CLAUDE.md.
Definition in file ra8_pin_interface.h.