PEAK PCAN-USB FD¶
Open a PEAK PCAN-USB FD adapter directly over USB on Linux, macOS, or Windows.
PeakAdapter() uses the default bus timing; pass a PeakConfig to customize
timing and the transmit timeout. USB access permissions are required.
Configuration¶
The configuration is shared by the async and sync APIs. Omitted bitrate settings
use 500 kbit/s nominal and 2 Mbit/s data timing, with 80% sample points. The
transmit timeout defaults to one second; tx_timeout=None disables it.
detach_kernel_driver defaults to False. Opening fails if a kernel driver
such as peak_usb already owns the USB interface. Set
PeakConfig(detach_kernel_driver=True) to allow detaching that driver while
the raw-USB adapter is open, interrupting SocketCAN access. The driver is
reattached when the adapter is released. Both APIs share this setting, and
automatic discovery leaves kernel drivers attached.
- class automotive.adapters.PeakConfig(*, bitrate: BitrateSettings | None = None, tx_timeout: float | None = 1.0, detach_kernel_driver: bool = False)[source]¶
Configure a PEAK PCAN-USB FD adapter.
- Parameters:
bitrate – Timing inputs. None uses Rust’s 500 kbit/s nominal and 2 Mbit/s data timing, with 80% sample points.
tx_timeout – Queue-admission/confirmation deadline in seconds; default one second. None disables the deadline; zero is invalid.
detach_kernel_driver – Allow detaching a kernel driver to claim the USB interface, default False. Otherwise opening fails if a kernel driver owns it. True interrupts SocketCAN access until the adapter is released and the kernel driver is reattached.
A timeout clears the transmit queue, cancelling other affected sends. BRS requires a configured FD data bitrate.
- tx_timeout: float | None¶
- detach_kernel_driver: bool¶
- backend: ClassVar[str] = 'peak'¶
- bitrate: BitrateSettings | None¶
- property resolved_bitrate: BitrateConfig | None¶
Calculated timing for this backend, including its defaults.
Asynchronous API¶
Send, receive, and lifecycle methods are inherited from
automotive.adapters.CanAdapter.
- class automotive.adapters.PeakAdapter(config: PeakConfig | None = None)[source]¶
Bases:
CanAdapterOpen a PEAK PCAN-USB FD adapter immediately.
- Parameters:
config – Reusable PeakConfig; None uses Rust defaults.
Synchronous API¶
Blocking methods are inherited from automotive.sync.adapters.CanAdapter.
- class automotive.sync.adapters.PeakAdapter(config: PeakConfig | None = None)[source]¶
Bases:
CanAdapterOpen a PEAK PCAN-USB FD adapter immediately.
- Parameters:
config – Reusable PeakConfig; None uses Rust defaults.