canbus

package module
v0.0.0-...-b14e35a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 9 Imported by: 1

README

canbus

Golang Canbus library

Documentation

Index

Constants

View Source
const DefaultBitRate = 250000

DefaultBitRate is the bitrate that Channel defaults to using.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ChannelOptions ChannelOptions
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(ctx context.Context, log *logrus.Logger, ChannelOptions ChannelOptions, opts ...ChannelOption) (*Channel, error)

func (*Channel) Close

func (c *Channel) Close(ctx context.Context) error

func (*Channel) WriteFrame

func (c *Channel) WriteFrame(frame can.Frame) error

type ChannelOption

type ChannelOption func(*Channel)

ChannelOption is the type used to apply function options to Channel.

func WithBitRate

func WithBitRate(br int32) ChannelOption

WithBitRate overrides the DefaultBitRate set on Channel.

type ChannelOptions

type ChannelOptions struct {
	CanInterfaceName string
	MessageHandler   can.HandlerFunc
}

ChannelOptions is a type that contains required options on a Channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL