combi

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package combi drives the CombiAdapter over USB via gotmc/libusb (cgo; requires libusb-1.0). Importing the package registers the "CombiAdapter" adapter. It is kept out of adapters/all so that package stays pure Go — import this package directly.

Wire protocol: packets are cmd, size (u16 BE), payload, terminator (0x00 ack / 0xFF nak) in both directions. The firmware acks every TX frame (cmdCanTxFrame back) and is single-threaded, so Send waits for the ack before returning; the Bus serializes Send callers.

Firmware 1.2 added a CAN acceptance filter (cmdCanFilter): up to 32 little-endian uint32 IDs, dropped on the adapter before they cross USB. Open reads the firmware version and only installs the filter on >= 1.2 (1.2: at most 7 ids); older firmware relays the whole bus and the Bus's subscription dispatch does the filtering host-side. Firmware 1.3 keeps the same wire protocol and only fixes firmware bugs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg gocan.Config) (gocan.Adapter, error)

Types

type Combi

type Combi struct {
	// contains filtered or unexported fields
}

func (*Combi) Close

func (ca *Combi) Close() error

func (*Combi) GetADCValue

func (ca *Combi) GetADCValue(ctx context.Context, channel int) (float64, error)

GetADCValue reads one of the board's analog inputs (float32 reply). Requires the read loop for the reply.

func (*Combi) Open

func (ca *Combi) Open(ctx context.Context, bus *gocan.Bus) error

func (*Combi) Send

func (ca *Combi) Send(ctx context.Context, f gocan.Frame) error

Send writes one frame and waits for the firmware's per-frame ack (the firmware is single-threaded; outrunning it loses responses). The Bus never calls Send concurrently.

The firmware only uses CAN TX buffer 1 and NAKs the frame (without queuing it) while that buffer still holds the previous one — lost arbitration on a busy bus, or a slow bitrate. A NAK is resent until the ack deadline.

Jump to

Keyboard shortcuts

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