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 ¶
Types ¶
type Combi ¶
type Combi struct {
// contains filtered or unexported fields
}
func (*Combi) GetADCValue ¶
GetADCValue reads one of the board's analog inputs (float32 reply). Requires the read loop for the reply.
func (*Combi) Send ¶
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.