cdc

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

package cdc is for USB Communication Device Class devices.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBufferEmpty = errors.New("USB-CDC buffer empty")
)

Functions

func EnableUSBCDC

func EnableUSBCDC()

func NewRxRingBuffer

func NewRxRingBuffer() *rxRingBuffer

NewRxRingBuffer returns a new ring buffer.

func NewTxRingBuffer

func NewTxRingBuffer() *txRingBuffer

NewTxRingBuffer returns a new ring buffer.

Types

type USBCDC

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

USBCDC is the USB CDC aka serial over USB interface.

var (
	// USB is a USB CDC interface.
	USB *USBCDC
)

func New

func New() *USBCDC

New returns USBCDC struct.

func (*USBCDC) Buffered

func (usbcdc *USBCDC) Buffered() int

Buffered returns the number of bytes currently stored in the RX buffer.

func (*USBCDC) Configure

func (usbcdc *USBCDC) Configure(config machine.UARTConfig) error

Configure the USB CDC interface. The config is here for compatibility with the UART interface.

func (*USBCDC) DTR

func (usbcdc *USBCDC) DTR() bool

func (*USBCDC) Flush

func (usbcdc *USBCDC) Flush()

Flush flushes buffered data.

func (*USBCDC) RTS

func (usbcdc *USBCDC) RTS() bool

func (*USBCDC) Read

func (usbcdc *USBCDC) Read(data []byte) (n int, err error)

Read from the RX buffer.

func (*USBCDC) ReadByte

func (usbcdc *USBCDC) ReadByte() (byte, error)

ReadByte reads a single byte from the RX buffer. If there is no data in the buffer, returns an error.

func (*USBCDC) Receive

func (usbcdc *USBCDC) Receive(data byte)

Receive handles adding data to the UART's data buffer. Usually called by the IRQ handler for a machine.

func (*USBCDC) Write

func (usbcdc *USBCDC) Write(data []byte) (n int, err error)

Write data to the USBCDC.

func (*USBCDC) WriteByte

func (usbcdc *USBCDC) WriteByte(c byte) error

WriteByte writes a byte of data to the USB CDC interface.

Jump to

Keyboard shortcuts

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