Expand description
USB GS_USB class — CAN bus adapter protocol.
Implements the Geschwister Schneider / candleLight USB-CAN protocol used by
the Linux gs_usb driver (drivers/net/can/usb/gs_usb.c).
§Protocol overview
- Interface class: vendor-specific (0xFF).
- Bulk IN / OUT endpoints carry
GsHostFramepackets. - Vendor control transfers handle configuration (bit timing, mode, etc.).
§Example
ⓘ
use my_hal_usb::{UsbBusAllocator, UsbDeviceBuilder};
use my_hal_usb::class::gs_usb::GsUsbClass;
use my_hal_usb::MyBus;
let alloc = UsbBusAllocator::new(MyBus::new(/* peripheral */));
let mut gs_usb = GsUsbClass::new(&alloc);
let mut dev = UsbDeviceBuilder::new(&alloc, 0x1D50, 0x606F)
.product("candleLight RP2350")
.build();
loop {
if dev.poll(&mut [&mut gs_usb]) {
// Handle CAN frames via gs_usb.try_recv() / gs_usb.try_send()
}
}Modules§
- gs_
can_ flag - Per-frame flags in
GsCanFrame(same bits ascanfd_frame.flags). - gs_
can_ mode - CAN controller operational mode (
GS_USB_BREQ_MODEfirst word). - gs_
can_ mode_ flags - Mode flags for the second word of a
GS_USB_BREQ_MODErequest. - gs_
usb_ breq - GS_USB vendor control request codes (
bRequest).
Structs§
- GsDevice
BitTiming - Host→device request to set CAN bit timing.
- GsDevice
BtConst - Response to
GS_USB_BREQ_BT_CONST— CAN bit-timing constraints. - GsDevice
Config - Response to
GS_USB_BREQ_DEVICE_CONFIG. - GsHost
Frame - A CAN frame as transmitted over USB bulk endpoints.
- GsUsb
Class - USB GS_USB class implementing the candleLight / Linux
gs_usbprotocol.