|
| virtual | ~BaseCan () noexcept=default |
| | Virtual destructor ensures proper cleanup in derived classes.
|
| |
| | BaseCan (const BaseCan &)=delete |
| |
| BaseCan & | operator= (const BaseCan &)=delete |
| |
| | BaseCan (BaseCan &&)=delete |
| |
| BaseCan & | operator= (BaseCan &&)=delete |
| |
| bool | EnsureInitialized () noexcept |
| | Ensures that the CAN bus is initialized (lazy initialization).
|
| |
| bool | EnsureDeinitialized () noexcept |
| | Ensures that the CAN bus is deinitialized.
|
| |
| bool | IsInitialized () const noexcept |
| | Checks if the class is initialized.
|
| |
| virtual hf_can_err_t | Initialize () noexcept=0 |
| | Initialize the CAN controller (must be implemented by derived classes).
|
| |
| virtual hf_can_err_t | Deinitialize () noexcept=0 |
| | Deinitialize the CAN controller (must be implemented by derived classes).
|
| |
| virtual hf_can_err_t | SendMessage (const hf_can_message_t &message, hf_u32_t timeout_ms=1000) noexcept=0 |
| | Send a CAN message.
|
| |
| virtual hf_can_err_t | ReceiveMessage (hf_can_message_t &message, hf_u32_t timeout_ms=0) noexcept=0 |
| | Receive a CAN message.
|
| |
| virtual hf_can_err_t | SetReceiveCallback (hf_can_receive_callback_t callback) noexcept=0 |
| | Set callback for received messages.
|
| |
| virtual hf_can_err_t | SetAcceptanceFilter (hf_u32_t id, hf_u32_t mask, bool extended=false) noexcept=0 |
| | Set acceptance filter for incoming messages.
|
| |
| virtual hf_can_err_t | GetStatus (hf_can_status_t &status) noexcept=0 |
| | Get current CAN bus status.
|
| |
| virtual hf_can_err_t | Reset () noexcept=0 |
| | Reset the CAN controller.
|
| |
| virtual void | ClearReceiveCallback () noexcept |
| | Clear the receive callback.
|
| |
| virtual hf_can_err_t | ClearAcceptanceFilter () noexcept |
| | Clear all acceptance filters (accept all messages).
|
| |
| virtual hf_can_err_t | SetReceiveCallbackFD (hf_can_fd_receive_callback_t callback) noexcept |
| | Set CAN-FD receive callback with enhanced information.
|
| |
| virtual bool | SupportsCanFD () const noexcept |
| | Check if CAN-FD is supported by this controller.
|
| |
| virtual bool | SetCanFDMode (bool enable, hf_u32_t data_baudrate=2000000, hf_u32_t timeout_ms=1000) noexcept |
| | Enable or disable CAN-FD mode.
|
| |
| virtual bool | ConfigureCanFDTiming (hf_u16_t nominal_prescaler, hf_u8_t nominal_tseg1, hf_u8_t nominal_tseg2, hf_u16_t data_prescaler, hf_u8_t data_tseg1, hf_u8_t data_tseg2, hf_u8_t sjw=1) noexcept |
| | Configure CAN-FD timing parameters.
|
| |
| virtual bool | SetTransmitterDelayCompensation (hf_u8_t tdc_offset, hf_u8_t tdc_filter) noexcept |
| | Set transmitter delay compensation (CAN-FD feature).
|
| |
| virtual hf_u32_t | SendMessageBatch (const hf_can_message_t *messages, hf_u32_t count, hf_u32_t timeout_ms=1000) noexcept |
| | Send multiple messages in a batch.
|
| |
| virtual hf_u32_t | ReceiveMessageBatch (hf_can_message_t *messages, hf_u32_t max_count, hf_u32_t timeout_ms=100) noexcept |
| | Receive multiple messages in a batch.
|
| |
| virtual hf_can_err_t | ResetStatistics () noexcept |
| | Reset CAN operation statistics.
|
| |
| virtual hf_can_err_t | ResetDiagnostics () noexcept |
| | Reset CAN diagnostic information.
|
| |
| virtual hf_can_err_t | GetStatistics (hf_can_statistics_t &statistics) noexcept |
| | Get CAN operation statistics.
|
| |
| virtual hf_can_err_t | GetDiagnostics (hf_can_diagnostics_t &diagnostics) noexcept |
| | Get CAN diagnostic information.
|
| |
Abstract base class defining the unified CAN bus API.
This abstract class defines the interface that all CAN controller implementations must provide. It ensures a consistent API across different platforms and CAN controller types, making the system extensible and maintainable.
Concrete implementation examples:
- Microcontrollers with integrated CAN peripherals
- External CAN controllers via SPI (e.g. MCP2515)
Features:
- Lazy initialization support (initialize on first use)
- Comprehensive error handling with detailed error codes
- Thread-safe operations (implementation dependent)
- Consistent API across different CAN hardware
- Note
- This is a header-only abstract base class - instantiate concrete implementations instead.