HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
HardwareTypes.h File Reference

Platform-agnostic hardware type definitions for the HardFOC system. More...

#include <cstdint>
#include <limits>
Include dependency graph for HardwareTypes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

using hf_u8_t = uint8_t
 Platform-agnostic 8-bit unsigned integer type.
 
using hf_u16_t = uint16_t
 Platform-agnostic 16-bit unsigned integer type.
 
using hf_u32_t = uint32_t
 Platform-agnostic 32-bit unsigned integer type.
 
using hf_u64_t = uint64_t
 Platform-agnostic 64-bit unsigned integer type.
 
using hf_i8_t = int8_t
 Platform-agnostic 8-bit signed integer type.
 
using hf_i16_t = int16_t
 Platform-agnostic 16-bit signed integer type.
 
using hf_i32_t = int32_t
 Platform-agnostic 32-bit signed integer type.
 
using hf_i64_t = int64_t
 Platform-agnostic 64-bit signed integer type.
 
using hf_bool_t = bool
 Platform-agnostic boolean type.
 
using hf_pin_num_t = hf_i32_t
 Platform-agnostic GPIO pin number type.
 
using hf_port_num_t = hf_u32_t
 Platform-agnostic port/controller identifier type.
 
using hf_host_id_t = hf_u32_t
 Platform-agnostic host/controller identifier type.
 
using hf_frequency_hz_t = hf_u32_t
 Platform-agnostic frequency type (in Hz).
 
using hf_frequency_t = hf_frequency_hz_t
 Backward compatibility alias.
 
using hf_baud_rate_t = hf_u32_t
 Platform-agnostic baud rate type.
 
using hf_channel_id_t = hf_u32_t
 Platform-agnostic channel identifier type.
 
using hf_time_t = hf_u32_t
 Platform-agnostic time type in milliseconds.
 
using hf_timeout_ms_t = hf_time_t
 Timeout value in milliseconds.
 
using hf_timeout_us_t = hf_time_t
 Timeout value in microseconds.
 
using hf_timestamp_us_t = hf_u64_t
 Timestamp value in microseconds.
 

Functions

constexpr bool IsValidPin (hf_pin_num_t pin) noexcept
 Check if a pin number is valid.
 
constexpr bool IsValidPort (hf_port_num_t port) noexcept
 Check if a port number is valid.
 
constexpr bool IsValidHost (hf_host_id_t host) noexcept
 Check if a host ID is valid.
 
constexpr bool IsValidChannel (hf_channel_id_t channel) noexcept
 Check if a channel ID is valid.
 

Variables

constexpr hf_pin_num_t HF_INVALID_PIN = -1
 Invalid pin constant for unassigned or invalid pins.
 
constexpr hf_pin_num_t HF_MAX_PIN_NUMBER = 255
 Maximum pin number supported by the abstraction layer.
 
constexpr hf_port_num_t HF_INVALID_PORT = std::numeric_limits<hf_port_num_t>::max()
 Invalid port constant for unassigned or invalid ports.
 
constexpr hf_host_id_t HF_INVALID_HOST = std::numeric_limits<hf_host_id_t>::max()
 Invalid host constant for unassigned or invalid hosts.
 
constexpr hf_channel_id_t HF_INVALID_CHANNEL = std::numeric_limits<hf_channel_id_t>::max()
 Invalid channel constant for unassigned or invalid channels.
 
constexpr hf_time_t HF_TIMEOUT_DEFAULT_MS = 1000
 Default timeout value in milliseconds.
 
constexpr hf_time_t HF_TIMEOUT_NONE = 0
 No timeout (wait indefinitely).
 
constexpr hf_time_t HF_TIMEOUT_MAX = std::numeric_limits<hf_time_t>::max()
 Maximum timeout value.
 

Detailed Description

Platform-agnostic hardware type definitions for the HardFOC system.

This file defines platform-agnostic types used by base interface classes. These types provide a consistent API across different hardware platforms without exposing MCU-specific implementation details. All hardware abstraction layers use these common types for portability and consistency.

Author
Nebiyu Tadesse
Date
2025
Note
These types are designed to be platform-independent and should not include any MCU-specific headers or definitions.

Typedef Documentation

◆ hf_baud_rate_t

Platform-agnostic baud rate type.

◆ hf_bool_t

using hf_bool_t = bool

Platform-agnostic boolean type.

Wraps bool for consistent naming and future extensibility.

◆ hf_channel_id_t

Platform-agnostic channel identifier type.

Used for ADC channels, PWM channels, etc.

◆ hf_frequency_hz_t

Platform-agnostic frequency type (in Hz).

◆ hf_frequency_t

Backward compatibility alias.

◆ hf_host_id_t

Platform-agnostic host/controller identifier type.

Used for SPI hosts, I2C controllers, etc.

◆ hf_i16_t

using hf_i16_t = int16_t

Platform-agnostic 16-bit signed integer type.

Wraps int16_t for consistent naming across the HardFOC system.

◆ hf_i32_t

using hf_i32_t = int32_t

Platform-agnostic 32-bit signed integer type.

Wraps int32_t for consistent naming across the HardFOC system.

◆ hf_i64_t

using hf_i64_t = int64_t

Platform-agnostic 64-bit signed integer type.

Wraps int64_t for consistent naming across the HardFOC system.

◆ hf_i8_t

using hf_i8_t = int8_t

Platform-agnostic 8-bit signed integer type.

Wraps int8_t for consistent naming across the HardFOC system.

◆ hf_pin_num_t

Platform-agnostic GPIO pin number type.

Generic pin identifier that works across different hardware platforms. Uses hf_i32_t to handle both positive pin numbers and invalid (-1) values.

◆ hf_port_num_t

Platform-agnostic port/controller identifier type.

Generic identifier for communication ports (I2C, SPI, UART, etc.). Uses hf_u32_t to accommodate various controller numbering schemes.

◆ hf_time_t

Platform-agnostic time type in milliseconds.

◆ hf_timeout_ms_t

Timeout value in milliseconds.

◆ hf_timeout_us_t

Timeout value in microseconds.

◆ hf_timestamp_us_t

Timestamp value in microseconds.

◆ hf_u16_t

using hf_u16_t = uint16_t

Platform-agnostic 16-bit unsigned integer type.

Wraps uint16_t for consistent naming across the HardFOC system.

◆ hf_u32_t

using hf_u32_t = uint32_t

Platform-agnostic 32-bit unsigned integer type.

Wraps uint32_t for consistent naming across the HardFOC system.

◆ hf_u64_t

using hf_u64_t = uint64_t

Platform-agnostic 64-bit unsigned integer type.

Wraps uint64_t for consistent naming across the HardFOC system.

◆ hf_u8_t

using hf_u8_t = uint8_t

Platform-agnostic 8-bit unsigned integer type.

Wraps uint8_t for consistent naming across the HardFOC system.

Function Documentation

◆ IsValidChannel()

constexpr bool IsValidChannel ( hf_channel_id_t channel)
constexprnoexcept

Check if a channel ID is valid.

Parameters
channelChannel ID to validate
Returns
true if valid, false otherwise

◆ IsValidHost()

constexpr bool IsValidHost ( hf_host_id_t host)
constexprnoexcept

Check if a host ID is valid.

Parameters
hostHost ID to validate
Returns
true if valid, false otherwise

◆ IsValidPin()

constexpr bool IsValidPin ( hf_pin_num_t pin)
constexprnoexcept

Check if a pin number is valid.

Parameters
pinPin number to validate
Returns
true if valid, false otherwise

◆ IsValidPort()

constexpr bool IsValidPort ( hf_port_num_t port)
constexprnoexcept

Check if a port number is valid.

Parameters
portPort number to validate
Returns
true if valid, false otherwise

Variable Documentation

◆ HF_INVALID_CHANNEL

constexpr hf_channel_id_t HF_INVALID_CHANNEL = std::numeric_limits<hf_channel_id_t>::max()
constexpr

Invalid channel constant for unassigned or invalid channels.

◆ HF_INVALID_HOST

constexpr hf_host_id_t HF_INVALID_HOST = std::numeric_limits<hf_host_id_t>::max()
constexpr

Invalid host constant for unassigned or invalid hosts.

◆ HF_INVALID_PIN

constexpr hf_pin_num_t HF_INVALID_PIN = -1
constexpr

Invalid pin constant for unassigned or invalid pins.

◆ HF_INVALID_PORT

constexpr hf_port_num_t HF_INVALID_PORT = std::numeric_limits<hf_port_num_t>::max()
constexpr

Invalid port constant for unassigned or invalid ports.

◆ HF_MAX_PIN_NUMBER

constexpr hf_pin_num_t HF_MAX_PIN_NUMBER = 255
constexpr

Maximum pin number supported by the abstraction layer.

◆ HF_TIMEOUT_DEFAULT_MS

constexpr hf_time_t HF_TIMEOUT_DEFAULT_MS = 1000
constexpr

Default timeout value in milliseconds.

◆ HF_TIMEOUT_MAX

constexpr hf_time_t HF_TIMEOUT_MAX = std::numeric_limits<hf_time_t>::max()
constexpr

Maximum timeout value.

◆ HF_TIMEOUT_NONE

constexpr hf_time_t HF_TIMEOUT_NONE = 0
constexpr

No timeout (wait indefinitely).