HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
CommChannelsManager.h File Reference

Communication channels manager for the HardFOC Flux V1 platform. More...

#include <array>
#include <atomic>
#include <cstdint>
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/base/BaseSpi.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/base/BaseCan.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/base/BaseUart.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/base/BaseUsbSerialJtag.h"
#include "RtosMutex.h"
#include "flux_hal/flux_hal_types.hpp"
Include dependency graph for CommChannelsManager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CommSystemDiagnostics
 System-level diagnostics snapshot for communication channels. More...
 
class  CommChannelsManager
 Singleton managing all board communication channels for Flux V1. More...
 
struct  CommChannelsManager::UartAcquireConfig
 Lazy-acquire configuration for a hardware UART port. More...
 

Enumerations

enum class  CommError : uint8_t {
  SUCCESS = 0 , NOT_INITIALIZED , INITIALIZATION_FAILED , BUS_NOT_AVAILABLE ,
  DEVICE_NOT_FOUND , INVALID_BUS_INDEX , INVALID_DEVICE_INDEX , DEVICE_ALREADY_EXISTS ,
  DEVICE_CREATION_FAILED , COMMUNICATION_FAILED , INVALID_PARAMETER , MUTEX_LOCK_FAILED
}
 Communication channels manager error codes for consistent error reporting. More...
 
enum class  SpiDeviceId : uint8_t { MAX22200_SOLENOID_DRIVER = 0 , TLE92466_LOWSIDE_DRIVER = 1 , ADS7952_ADC_0 = 2 , DEVICE_COUNT }
 SPI device identifiers for the Flux V1 board. More...
 

Functions

constexpr const char * CommErrorToString (CommError error) noexcept
 Convert CommError to a human-readable string.
 
CommChannelsManager & GetCommChannelsManager () noexcept
 Convenience accessor — equivalent to CommChannelsManager::GetInstance().
 

Detailed Description

Communication channels manager for the HardFOC Flux V1 platform.

Manages board communication buses (SPI, CAN, lazy UART) for the Flux valve-control board. SPI talks to:

The bus objects are created by the platform binding (bsp_bind/FluxPlatformBind.h) in its static storage; this manager decides which buses and chip selects exist (pin map + board config) and holds Base* pointers only, so this header is MCU-free.

Author
HardFOC Team
Date
2026
Version
1.0

Enumeration Type Documentation

◆ CommError

enum class CommError : uint8_t
strong

Communication channels manager error codes for consistent error reporting.

Manager-layer errors for communication bus lifecycle and device operations. Covers SPI, I2C, and CAN bus management failures.

Enumerator
SUCCESS 

Operation completed successfully.

NOT_INITIALIZED 

Manager not yet initialised.

INITIALIZATION_FAILED 

Bus or device initialisation failed.

BUS_NOT_AVAILABLE 

Requested bus is not present or not ready.

DEVICE_NOT_FOUND 

Device index or id not in registry.

INVALID_BUS_INDEX 

Bus index out of range.

INVALID_DEVICE_INDEX 

Device index out of range.

DEVICE_ALREADY_EXISTS 

A device at that address already exists.

DEVICE_CREATION_FAILED 

Heap allocation or driver init for device failed.

COMMUNICATION_FAILED 

A bus-level transfer failed.

INVALID_PARAMETER 

Null pointer or out-of-range argument.

MUTEX_LOCK_FAILED 

RTOS mutex acquire timed out.

◆ SpiDeviceId

enum class SpiDeviceId : uint8_t
strong

SPI device identifiers for the Flux V1 board.

SPI2 bus: MAX22200 + TLE92466ED (shared bus, valves) SPI3 bus: ADS7952 ADC devices (dedicated bus, external ADC)

Enumerator
MAX22200_SOLENOID_DRIVER 

MAX22200 octal solenoid driver (SPI2, Mode 0)

TLE92466_LOWSIDE_DRIVER 

TLE92466ED six-channel driver (SPI2, Mode 1)

ADS7952_ADC_0 

ADS7952 12-ch ADC device 0 (SPI3, Mode 0)

DEVICE_COUNT 

Sentinel — total number of SPI devices.

Function Documentation

◆ CommErrorToString()

constexpr const char * CommErrorToString ( CommError  error)
constexprnoexcept

Convert CommError to a human-readable string.

Parameters
errorError code to convert.
Returns
Null-terminated string representation.

◆ GetCommChannelsManager()

CommChannelsManager & GetCommChannelsManager ( )
inlinenoexcept

Convenience accessor — equivalent to CommChannelsManager::GetInstance().

Returns
Reference to the singleton CommChannelsManager.
Here is the call graph for this function: