# Packages
No description provided by the author
# README
can
Origin
The project was originally created by brutella.
can provides an interface to a CAN bus to read and write frames. The library is based on the SocketCAN network stack on Linux.
##Usage
Setup the CAN bus
bus, _ := can.NewBusForInterfaceWithName("can0")
bus.ConnectAndPublish()
Send a CAN frame
frm := can.Frame{
ID: 0x701,
Length: 1,
Flags: 0,
Res0: 0,
Res1: 0,
Data: [8]uint8{0x05},
}
bus.Publish(frm)
Receive a CAN frame
bus.SubscribeFunc(handleCANFrame)
func handleCANFrame(frm can.Frame) {
...
}
There is more to learn from the documentation.
License
can is available under the MIT license. See the LICENSE file for more info.