Skip to content
/ canopen Public
forked from brutella/canopen

Communicate with other CANopen nodes in Go

License

Notifications You must be signed in to change notification settings

ast-dd/canopen

 
 

Repository files navigation

This is a fork from github.com/brutella/canopen.

canopen

canopen lets you send and received data in a CANopen network.

The library contains basic functionality and doesn't aim to be a complete implementation of the CANopen protocol. You can find a complete CANopen implementation in the CANopenNode project.

CANopen

CANopen is a protocol to communicate on a CAN bus. Data is exchanged between nodes using CANopen frames, which uses a subset of the bytes in a CAN frames. This project extends the can library to interact with a CANopen nodes, which also was forked from brutella. Setup your hard- and software as described there.

You can find a very good documentation about CANopen here.

Usage

Setup the CAN bus interface
bus, _ := can.NewBusForInterfaceWithName("can0")
bus.ConnectAndPublish()
CANopen request/response communication

Parts of CANopen protocol are based on request/response communication. The library makes it easy to send a request and wait for the reponse.

// Frame to be sent
payload := []byte{...}
frame := canopen.NewFrame(canopen.MessageTypeRSDO, payload)

// Expected id of response frame
respID := canopen.MessageTypeTSDO

req := canopen.NewRequest(frame, respID)

// Create client which sends request and waits for response
client := &canopen.Client{bus, time.Second * 1}
resp, _ := client.Do(req)

License

canopen is available under the MIT license. See the LICENSE file for more info.

About

Communicate with other CANopen nodes in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%