hollyhock
Loading...
Searching...
No Matches
usb.h File Reference

Functions used for sending and receiving data via USB. More...

#include <stdint.h>
#include <stdbool.h>
#include <sdk/os/comm.h>
Include dependency graph for usb.h:

Go to the source code of this file.

Macros

#define constexpr
#define ro(...)
#define rw(...)
#define wo(...)

Variables

enum Comm_Status(* USB_Open )(uint16_t mode)
enum Comm_Status(* USB_IsOpen )(void)
enum Comm_Status(* USB_Close )(void)
enum Comm_Status(* USB_ForceClose )(uint16_t mode)
enum Comm_Status(* USB_Read )(void *out, uint16_t sz, uint16_t *count) wo(1) wo(3)
enum Comm_Status(* USB_ReadSingle )(void *out) wo(1)
enum Comm_Status(* USB_Peek )(uint16_t idx, void *out) wo(2)
uint16_t(* USB_PollRX )(void)
enum Comm_Status(* USB_ClearRX )(void)
enum Comm_Status(* USB_Write )(const void *buf, uint16_t count) ro(1)
enum Comm_Status(* USB_WriteSingle )(uint8_t x)
enum Comm_Status(* USB_WriteUnbuffered )(uint8_t x)
uint16_t(* USB_PollTX )(void)
enum Comm_Status(* USB_ClearTX )(void)

Detailed Description

Functions used for sending and receiving data via USB.

Macro Definition Documentation

◆ ro

#define ro ( ...)
Value:
__attribute__((access(read_only, __VA_ARGS__)))

◆ rw

#define rw ( ...)
Value:
__attribute__((access(read_write, __VA_ARGS__)))

◆ wo

#define wo ( ...)
Value:
__attribute__((access(write_only, __VA_ARGS__)))

Variable Documentation

◆ USB_Open

enum Comm_Status(* USB_Open) (uint16_t mode) ( uint16_t mode)
extern

Opens the USB port. Abortable by pressing Clear/On Does not set comm open flag meaning you want to use USB_ForceClose

Parameters
modeInherited from the Comm interface; needs to be 0x20
Returns
COMM_OK, COMM_BUSY, COMM_NOT_READY or COMM_CANCELLED (see Comm_Status)

◆ USB_PollRX

uint16_t(* USB_PollRX) (void) ( void )
extern
Returns
number of bytes available to read.

◆ USB_PollTX

uint16_t(* USB_PollTX) (void) ( void )
extern
Returns
number of bytes of free space in the transmit buffer.

◆ USB_Read

enum Comm_Status(* USB_Read) (void *out, uint16_t sz, uint16_t *count) wo(1) wo(3) ( void * out,
uint16_t sz,
uint16_t * count )
extern

Reads up to sz bytes into out and writes the number received to count.

◆ USB_Write

enum Comm_Status(* USB_Write) (const void *buf, uint16_t count) ro(1) ( const void * buf,
uint16_t count )
extern

Sends a number of bytes through the USB port, by putting them in the transmit buffer.

Parameters
bufpointer to buffer containing the bytes to transmit
countamount of bytes to transmit from buf