Commit 6da374c
committed
hal: Add C++ API (hal.hh) and pybind11 bindings on the new HAL API
Reintroduce a C++ interface after the getter/setter transition, built
strictly on the public C API and the user-land query API:
- hal.hh: type-safe C++ layer. Typed pin/param handles via traits<T>
(compile-time accessor selection), runtime-typed pin_t variant and
anypin (stored-type-tag multiplexing for name-based access), port
wrapper, component class, and ULAPI by-name query/set functions.
No hal_priv.h, no direct shared memory access, no re-implemented
library internals.
Handles re-read the shmem slot on every access so hal_link() slot
rewrites stay visible (C pointer-variable semantics). Query callback
exceptions are captured and re-thrown after the library releases the
HAL mutex, so a throwing setter cannot wedge the session.
- halpybind.cc: pybind11 module (halpp.so) exposing component, Pin,
hal_dir/hal_type_t enums and the by-name functions. Built alongside
the existing _hal/hal.py, replacing nothing.
- tests/halpp: Python and native C++ smoke suites covering component
lifecycle, typed pins/params, signals, linking, by-name get/set with
type coercion and range checks, port pins and error paths.
Based on the pybind11 branch by rene-dev, re-based on the new HAL API.1 parent 7f5b5ae commit 6da374c
6 files changed
Lines changed: 894 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
39 | 51 | | |
40 | 52 | | |
41 | 53 | | |
| 54 | + | |
0 commit comments