Adding a board¶
Write a board header, hook it into the selector and generate its pin table, in five steps.
- Copy the closest board header. Start from
src/hf_functional_pin_config_vortex_v1.hpporsrc/hf_functional_pin_config_flux_v1.hppand name ithf_functional_pin_config_<board>.hpp, with its own include guard. - Define the chips. Edit
HfGpioChipTypeandHfAdcChipTypeso they list the chips that carry pins on this board, MCU first (= 0). - Write the rows. One
X(...)per pin inHF_FUNCTIONAL_GPIO_PIN_LISTand per channel inHF_FUNCTIONAL_ADC_CHANNEL_LIST, grouped by category, with the fields from the pin model. Take every number from the schematic; record wiring facts in a/* ... */comment above the row. Keep the generated-table section and the helper functions unchanged. - Hook it into the selector. Add an
#elif defined(HARDFOC_BOARD_<BOARD>)branch tosrc/hf_functional_pin_config.hppand the macro to the#errormessage. - Document it. Add the board to
BOARDSintools/docs/generators/pins.py, copydocs/vortex-v1.mdto a page for the board with its region names (pins-<board>,adc-<board>), add the page todocs/.nav.ymland runhardfoc-docs gen.
Check it¶
c++ -std=c++20 -fsyntax-only -Wall -Wextra -Isrc -DHARDFOC_BOARD_<BOARD> tests/docs/quickstart.cpp
hardfoc-docs gen --check
mkdocs build --strict
The first line compiles every documented call against the new map. Then bump the submodule in the board HAL and define the macro there.
Rules for rows¶
| Rule | Why |
|---|---|
| Rows never move between categories silently | The HAL's GPIO manager registers gpio and user rows only |
Chip selects and resets are PIN_LOGIC_INVERTED when the net is active low |
Drivers set logical levels; the row holds the polarity |
| A net reachable from two chips gets two rows, one per chip, with a comment | Vortex V1 TMC9660 GPIO17/18 are the example |
| No pin number outside the header | Examples that call the SDK directly read it from the map or a constant derived from it |
Next: Testing and CI.