Versions in this module Expand all Collapse all v1 v1.1.0 Sep 3, 2026 Changes in this version + const MiniCANFDDefaultCANType + const MiniCANFDDefaultConfig + const MiniCANFDDefaultDataBitrate + const MiniCANFDDefaultFrameType + const MiniCANFDDefaultModel + const MiniCANFDDefaultNominalBitrate + const MiniCANFDDefaultReceiveTimeout + const MiniCANFDDefaultTransmitTimeout + const MiniCANFDMaxDataLength type Bus + func OpenMiniCANFD(cfg MiniCANFDConfig, opts ...Option) (*Bus, error) type ChannelBackend + const BackendMiniCANFD + type MiniCANFDConfig struct + CANType uint8 + Channel int + ChannelIndex int + Config uint8 + DataRate uint32 + DeviceIndex int + FrameType uint8 + LibraryPath string + Model uint8 + NominalRate uint32 + type MiniCANFDDeviceInfo struct + FirmwareVersion string + HardwareType string + HardwareVersion string + Index int + ManufactureDate string + SerialNumber string + func LookupMiniCANFDDevices(libraryPath string) (devices []MiniCANFDDeviceInfo, err error) v1.0.0 Jul 24, 2026 Changes in this version + const CANErrAck — linux/amd64 + const CANErrBusError — linux/amd64 + const CANErrBusOff — linux/amd64 + const CANErrCrtl — linux/amd64 + const CANErrLostArb — linux/amd64 + const CANErrMaskAll — linux/amd64 + const CANErrProt — linux/amd64 + const CANErrRestarted — linux/amd64 + const CANErrTrx — linux/amd64 + const CANErrTxTimeout — linux/amd64 + var ErrBusClosed = errors.New("can: bus is closed") + var ErrBusHeavy = errors.New("can: bus heavy") + var ErrBusLight = errors.New("can: bus light") + var ErrBusOff = errors.New("can: bus off") + var ErrBusPassive = errors.New("can: bus passive") + var ErrDLLNotFound = errors.New("can: PCANBasic.dll not found or failed to load") + var ErrDataTooLong = errors.New("can: data length exceeds capacity") + var ErrDuplicateName = errors.New("gocan: duplicate bus name in group") + var ErrFDNotSupportedOnBus = errors.New("can: FD frame requires a bus opened with OpenFD or OpenSLCANFD") + var ErrIDOutOfRange = errors.New("can: CAN ID out of range") + var ErrIllHandle = errors.New("can: invalid channel handle") + var ErrIllOperation = errors.New("can: illegal operation") + var ErrIllParamType = errors.New("can: invalid parameter type") + var ErrIllParamValue = errors.New("can: invalid parameter value") + var ErrInvalidFDLength = errors.New("can: invalid CAN FD data length") + var ErrInvalidName = errors.New("gocan: invalid bus name") + var ErrNoDriver = errors.New("can: driver not loaded") + var ErrNotInitialized = errors.New("can: channel not initialized") + var ErrNotSupported = errors.New("can: operation not supported by current backend") + var ErrQueueEmpty = errors.New("can: receive queue empty") + var ErrQueueOverrun = errors.New("can: receive queue overrun") + var ErrQueueXmtFull = errors.New("can: transmit queue full") + var ErrRemoteOnFD = errors.New("can: remote frame not allowed on CAN FD") + var ErrSLCANESINotSupported = errors.New("can: CANable SLCAN-FD cannot encode ESI") + var ErrSLCANProtocol = errors.New("can: malformed SLCAN record") + var ErrUnknown = errors.New("can: unknown error") + func StatusHas(status, bit Status) bool + type Bitrate = raw.TPCANBaudrate + const Baud100K + const Baud10K + const Baud125K + const Baud1M + const Baud20K + const Baud250K + const Baud500K + const Baud50K + const Baud5K + type Bus struct + func Open(ch Channel, opts ...Option) (*Bus, error) + func OpenFD(ch Channel, fdBitrate string, opts ...Option) (*Bus, error) + func OpenSLCAN(port string, bitrate SLCANBitrate, opts ...Option) (*Bus, error) + func OpenSLCANFD(port string, bitrate SLCANBitrate, dataBitrate SLCANDataBitrate, ...) (*Bus, error) + func (b *Bus) Close() error + func (b *Bus) Errors() <-chan error + func (b *Bus) ReadOne(ctx context.Context) (Frame, error) + func (b *Bus) Receive() <-chan Frame + func (b *Bus) Reset() error + func (b *Bus) ResetFilter() error + func (b *Bus) Send(ctx context.Context, f Frame) error + func (b *Bus) SendMany(ctx context.Context, frames []Frame) error + func (b *Bus) SetErrFilter(mask uint32) error + func (b *Bus) SetFilter(idMin, idMax uint32, mode FilterMode) error + func (b *Bus) SetJoinFilters(and bool) error + func (b *Bus) Status() (Status, error) + func (b *Bus) TryRead() (Frame, error) + type BusGroup struct + func NewBusGroup(outBufferSize int) *BusGroup + func (g *BusGroup) Add(name string, ch Channel, opts ...Option) (*Bus, error) + func (g *BusGroup) AddFD(name string, ch Channel, fdBitrate string, opts ...Option) (*Bus, error) + func (g *BusGroup) AddSLCAN(name, port string, bitrate SLCANBitrate, opts ...Option) (*Bus, error) + func (g *BusGroup) AddSLCANFD(name, port string, bitrate SLCANBitrate, dataBitrate SLCANDataBitrate, ...) (*Bus, error) + func (g *BusGroup) Close() error + func (g *BusGroup) Each(fn func(name string, bus *Bus)) + func (g *BusGroup) Get(name string) (*Bus, bool) + func (g *BusGroup) Names() []string + func (g *BusGroup) Receive() <-chan SourcedFrame + type Channel = raw.TPCANHandle + const USBBus1 + const USBBus10 + const USBBus11 + const USBBus12 + const USBBus13 + const USBBus14 + const USBBus15 + const USBBus16 + const USBBus2 + const USBBus3 + const USBBus4 + const USBBus5 + const USBBus6 + const USBBus7 + const USBBus8 + const USBBus9 + func SocketCAN(iface string) Channel + type ChannelBackend string + const BackendPCAN + const BackendSLCAN + const BackendSocketCAN + type ChannelInfo struct + Backend ChannelBackend + Channel Channel + FD bool + Name string + Up bool + func LookupChannels() ([]ChannelInfo, error) + type DeviceInfo struct + Backend ChannelBackend + Channel Channel + ControllerNumber uint32 + DeviceNumber uint32 + FD bool + Features uint32 + HardwareName string + InterfaceName string + Name string + Up bool + func GetDeviceInfo(ch Channel) (DeviceInfo, error) + type Error struct + Code raw.TPCANStatus + Msg string + Op string + func (e *Error) Error() string + func (e *Error) Has(code raw.TPCANStatus) bool + func (e *Error) Is(target error) bool + type FilterMode uint8 + const FilterExtended + const FilterStandard + type Frame struct + Data []byte + Flags FrameFlags + ID uint32 + ReceivedAt time.Time + TimestampMicros uint64 + func NewExtendedFrame(id uint32, data []byte) (Frame, error) + func NewFDFrame(id uint32, data []byte, brs, extended bool) (Frame, error) + func NewFrame(id uint32, data []byte) (Frame, error) + func NewRemoteFrame(id uint32, dlc uint8, extended bool) (Frame, error) + func (f Frame) Has(flag FrameFlags) bool + type FrameFlags uint16 + const FlagBRS + const FlagESI + const FlagExtended + const FlagFD + const FlagRemote + type GroupCloseError struct + Causes map[string]error + func (e *GroupCloseError) Error() string + func (e *GroupCloseError) Unwrap() []error + type Logger interface + Debugf func(format string, args ...any) + Infof func(format string, args ...any) + Warnf func(format string, args ...any) + type Option func(*config) + func WithBitrate(b Bitrate) Option + func WithErrBufferSize(n int) Option + func WithErrFilter(mask uint32) Option + func WithJoinFilters(and bool) Option + func WithLogger(l Logger) Option + func WithLoopback(enabled bool) Option + func WithPollInterval(d time.Duration) Option + func WithRWTimeout(read, write time.Duration) Option + func WithReceiveMode(m ReceiveMode) Option + func WithRecvOwnMsgs(enabled bool) Option + func WithRecvTimestamp(mode RxTimestamp) Option + func WithRxBufferSize(n int) Option + func WithSLCANAutoRetransmit(enabled bool) Option + func WithSLCANSerialBaud(baud int) Option + func WithSLCANSilent(enabled bool) Option + func WithSocketBuffers(rcvBytes, sndBytes int) Option + type ReceiveMode int + const ModeAuto + const ModeEvent + const ModePolling + type RxTimestamp uint8 — linux/amd64 + const RxTimestampHardware + const RxTimestampNano + const RxTimestampNone + const RxTimestampSecond + type SLCANBitrate uint8 + const SLCANBitrate100K + const SLCANBitrate10K + const SLCANBitrate125K + const SLCANBitrate1M + const SLCANBitrate20K + const SLCANBitrate250K + const SLCANBitrate500K + const SLCANBitrate50K + const SLCANBitrate750K + const SLCANBitrate83K3 + type SLCANDataBitrate uint8 + const SLCANDataBitrate2M + const SLCANDataBitrate5M + type SLCANPortInfo struct + CANable2 bool + Name string + PID string + Product string + SerialNumber string + VID string + func LookupSLCANPorts() ([]SLCANPortInfo, error) + type SendManyError struct + Err error + Frame Frame + Index int + func (e *SendManyError) Error() string + func (e *SendManyError) Unwrap() error + type SourcedFrame struct + Frame Frame + Source string + type Status = raw.TPCANStatus + const StatusBusHeavy + const StatusBusLight + const StatusBusOff + const StatusBusPassive + const StatusOK + const StatusQueueOverrun