LSH-Core
Deterministic firmware core for Controllino-based Labo Smart Home nodes
 
Loading...
Searching...
No Matches
avr_fast_io.hpp File Reference

Typed helpers for AVR fast I/O access without Arduino macro casts. More...

#include <WProgram.h>
#include <stdint.h>
#include "internal/pin_tag.hpp"
Include dependency graph for avr_fast_io.hpp:

Go to the source code of this file.

Classes

struct  lsh::core::avr::FastInputPinBinding
 Resolved fast-input binding for one Arduino pin. More...
 
struct  lsh::core::avr::FastOutputPinBinding
 Resolved fast-output binding for one Arduino pin. More...
 
struct  lsh::core::avr::StaticPinDescriptor
 Compile-time descriptor for one fully resolved AVR pin binding. More...
 

Functions

auto lsh::core::avr::detail::inputRegisterFromAddress (uint16_t address) noexcept -> volatile const uint8_t *
 Rebuilds a read-only AVR register pointer from a raw MMIO address.
 
auto lsh::core::avr::detail::outputRegisterFromAddress (uint16_t address) noexcept -> volatile uint8_t *
 Rebuilds a writable AVR register pointer from a raw MMIO address.
 
auto lsh::core::avr::detail::modeRegisterFromAddress (uint16_t address) noexcept -> volatile uint8_t *
 Rebuilds a writable AVR DDR register pointer from a raw MMIO address.
 
auto lsh::core::avr::readPinBitMask (uint8_t pin) noexcept -> uint8_t
 Reads the fast-I/O bit mask for one runtime Arduino pin.
 
auto lsh::core::avr::readPinPortIndex (uint8_t pin) noexcept -> uint8_t
 Reads the Arduino core port index for one runtime pin.
 
auto lsh::core::avr::inputRegister (uint8_t port) noexcept -> volatile const uint8_t *
 Converts one Arduino core port index to the AVR input register.
 
auto lsh::core::avr::outputRegister (uint8_t port) noexcept -> volatile uint8_t *
 Converts one Arduino core port index to the AVR output register.
 
auto lsh::core::avr::modeRegister (uint8_t port) noexcept -> volatile uint8_t *
 Converts one Arduino core port index to the AVR DDR register.
 
auto lsh::core::avr::inputRegisterForPin (uint8_t pin) noexcept -> volatile const uint8_t *
 Resolves the AVR input register for one runtime Arduino pin.
 
auto lsh::core::avr::outputRegisterForPin (uint8_t pin) noexcept -> volatile uint8_t *
 Resolves the AVR output register for one runtime Arduino pin.
 
auto lsh::core::avr::modeRegisterForPin (uint8_t pin) noexcept -> volatile uint8_t *
 Resolves the AVR DDR register for one runtime Arduino pin.
 
auto lsh::core::avr::makeFastInputPinBinding (uint8_t pin) noexcept -> FastInputPinBinding
 Builds the cached fast-input binding for one runtime pin.
 
auto lsh::core::avr::makeFastOutputPinBinding (uint8_t pin) noexcept -> FastOutputPinBinding
 Builds the cached fast-output binding for one runtime pin.
 
template<uint8_t Pin>
auto lsh::core::avr::readPinBitMask (::lsh::core::PinTag< Pin >) noexcept -> uint8_t
 Returns the bit mask for one compile-time pin tag.
 
template<uint8_t Pin>
auto lsh::core::avr::inputRegisterForPin (::lsh::core::PinTag< Pin >) noexcept -> volatile const uint8_t *
 Resolves the AVR input register for one compile-time pin tag.
 
template<uint8_t Pin>
auto lsh::core::avr::outputRegisterForPin (::lsh::core::PinTag< Pin >) noexcept -> volatile uint8_t *
 Resolves the AVR output register for one compile-time pin tag.
 
template<uint8_t Pin>
auto lsh::core::avr::modeRegisterForPin (::lsh::core::PinTag< Pin >) noexcept -> volatile uint8_t *
 Resolves the AVR DDR register for one compile-time pin tag.
 
template<uint8_t Pin>
auto lsh::core::avr::makeFastInputPinBinding (::lsh::core::PinTag< Pin >) noexcept -> FastInputPinBinding
 Builds the cached fast-input binding for one compile-time pin tag.
 
template<uint8_t Pin>
auto lsh::core::avr::makeFastOutputPinBinding (::lsh::core::PinTag< Pin >) noexcept -> FastOutputPinBinding
 Builds the cached fast-output binding for one compile-time pin tag.
 

Detailed Description

Typed helpers for AVR fast I/O access without Arduino macro casts.

Author
Jacopo Labardi (labodj)

Copyright 2026 Jacopo Labardi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ readPinBitMask()

template<uint8_t Pin>
auto lsh::core::avr::readPinBitMask ( ::lsh::core::PinTag< Pin >  ) -> uint8_t
inlinenoexcept

Returns the bit mask for one compile-time pin tag.

When the target board and pin are known by the constexpr Mega mapping, this avoids the Arduino PROGMEM lookup tables entirely. Unsupported pins fall back to the traditional runtime path.

Here is the call graph for this function: