control.h File Reference

USBUS control endpoint module. More...

Detailed Description

USBUS control endpoint module.

USBUS control endpoint module interface

Author
Koen Zandberg koen@.nosp@m.berg.nosp@m.zand..nosp@m.net

Definition in file control.h.

#include "usb/usbus.h"
+ Include dependency graph for control.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  usbus_control_slicer_t
 helper struct to divide control messages in multiple parts More...
 
struct  usbus_control_handler_t
 Endpoint zero event handler. More...
 
void usbus_control_init (usbus_t *usbus, usbus_control_handler_t *handler)
 Initialize the control endpoint handler. More...
 
size_t usbus_control_slicer_put_bytes (usbus_t *usbus, const uint8_t *buf, size_t len)
 Helper function for adding bytes to the current control message part. More...
 
size_t usbus_control_slicer_put_char (usbus_t *usbus, char c)
 Helper function for adding single bytes to the current control message part. More...
 
void usbus_control_slicer_ready (usbus_t *usbus)
 Helper function to signal the end of the control message. More...
 
int usbus_control_slicer_nextslice (usbus_t *usbus)
 Initialize the next slice of the control message. More...
 
uint8_t * usbus_control_get_out_data (usbus_t *usbus, size_t *len)
 Retrieve the data from the OUT pipe of the control endpoint. More...
 

Function Documentation

◆ usbus_control_get_out_data()

uint8_t* usbus_control_get_out_data ( usbus_t usbus,
size_t *  len 
)

Retrieve the data from the OUT pipe of the control endpoint.

Precondition
usbus->state == USBUS_CONTROL_REQUEST_STATE_OUTDATA
Parameters
[in]usbusUSBUS context
[out]lenLength of the data part
Returns
pointer to the data buffer

◆ usbus_control_init()

void usbus_control_init ( usbus_t usbus,
usbus_control_handler_t handler 
)

Initialize the control endpoint handler.

Parameters
[in]usbusUSBUS context
[in]handlercontrol handler to initialize

◆ usbus_control_slicer_nextslice()

int usbus_control_slicer_nextslice ( usbus_t usbus)

Initialize the next slice of the control message.

Parameters
[in]usbusUSBUS context
Returns
1 when there is a next slice
0 when the data is fully transferred

◆ usbus_control_slicer_put_bytes()

size_t usbus_control_slicer_put_bytes ( usbus_t usbus,
const uint8_t *  buf,
size_t  len 
)

Helper function for adding bytes to the current control message part.

Parameters
[in]usbusUSBUS context
[in]bufBuffer to add bytes from
[in]lenLength of buf
Returns
Actual number of bytes written

◆ usbus_control_slicer_put_char()

size_t usbus_control_slicer_put_char ( usbus_t usbus,
char  c 
)

Helper function for adding single bytes to the current control message part.

Parameters
[in]usbusUSBUS context
[in]cbyte to add
Returns
Actual number of bytes written

◆ usbus_control_slicer_ready()

void usbus_control_slicer_ready ( usbus_t usbus)

Helper function to signal the end of the control message.

Parameters
[in]usbusUSBUS context