libDaisy
Hardware Library for Daisy
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
UsbHandle Class Reference

Interface for initializing and using the USB Peripherals on the daisy. More...

Detailed Description

Interface for initializing and using the USB Peripherals on the daisy.

Author
Stephen Hensley
Date
December 2019

#include <usb.h>

Public Types

enum class  Result { OK , ERR , OK , ERR }
 
enum  UsbPeriph {
  FS_INTERNAL , FS_EXTERNAL , FS_BOTH , FS_INTERNAL ,
  FS_EXTERNAL , FS_BOTH
}
 
enum class  Result { OK , ERR , OK , ERR }
 
enum  UsbPeriph {
  FS_INTERNAL , FS_EXTERNAL , FS_BOTH , FS_INTERNAL ,
  FS_EXTERNAL , FS_BOTH
}
 
typedef void(*) ReceiveCallback(uint8_t *buff, uint32_t *len)
 

Public Member Functions

 UsbHandle ()
 
 ~UsbHandle ()
 
void Init (UsbPeriph dev)
 
void DeInit (UsbPeriph dev)
 
Result TransmitInternal (uint8_t *buff, size_t size)
 
Result TransmitExternal (uint8_t *buff, size_t size)
 
void SetReceiveCallback (ReceiveCallback cb, UsbPeriph dev)
 
 UsbHandle ()
 
 ~UsbHandle ()
 
void Init (UsbPeriph dev)
 
void DeInit (UsbPeriph dev)
 
Result TransmitInternal (uint8_t *buff, size_t size)
 
Result TransmitExternal (uint8_t *buff, size_t size)
 
void SetReceiveCallback (ReceiveCallback cb, UsbPeriph dev)
 

Member Typedef Documentation

◆ ReceiveCallback

typedef void(* UsbHandle::ReceiveCallback)(uint8_t *buff, uint32_t *len)

Function called upon reception of a buffer

Member Enumeration Documentation

◆ Result [1/2]

enum class UsbHandle::Result
strong

Return values for USBHandle Functions

Enumerator
OK 
ERR 
OK 
ERR 

◆ Result [2/2]

enum class UsbHandle::Result
strong

Return values for USBHandle Functions

Enumerator
OK 
ERR 
OK 
ERR 

◆ UsbPeriph [1/2]

Specified which of the two USB Peripherals to initialize.

Enumerator
FS_INTERNAL 

Internal pin

FS_EXTERNAL 

FS External D+ pin is Pin 38 (GPIO32). FS External D- pin is Pin 37 (GPIO31)

FS_BOTH 

Both

FS_INTERNAL 

Internal pin

FS_EXTERNAL 

FS External D+ pin is Pin 38 (GPIO32). FS External D- pin is Pin 37 (GPIO31)

FS_BOTH 

Both

◆ UsbPeriph [2/2]

Specified which of the two USB Peripherals to initialize.

Enumerator
FS_INTERNAL 

Internal pin

FS_EXTERNAL 

FS External D+ pin is Pin 38 (GPIO32). FS External D- pin is Pin 37 (GPIO31)

FS_BOTH 

Both

FS_INTERNAL 

Internal pin

FS_EXTERNAL 

FS External D+ pin is Pin 38 (GPIO32). FS External D- pin is Pin 37 (GPIO31)

FS_BOTH 

Both

Constructor & Destructor Documentation

◆ UsbHandle() [1/2]

UsbHandle::UsbHandle ( )
inline

◆ ~UsbHandle() [1/2]

UsbHandle::~UsbHandle ( )
inline

◆ UsbHandle() [2/2]

UsbHandle::UsbHandle ( )
inline

◆ ~UsbHandle() [2/2]

UsbHandle::~UsbHandle ( )
inline

Member Function Documentation

◆ DeInit() [1/2]

void UsbHandle::DeInit ( UsbPeriph dev)

Deinitializes the specified peripheral(s)

Parameters
devDevice to deinitialize

◆ DeInit() [2/2]

void UsbHandle::DeInit ( UsbPeriph dev)

Deinitializes the specified peripheral(s)

Parameters
devDevice to deinitialize

◆ Init() [1/2]

void UsbHandle::Init ( UsbPeriph dev)

Initializes the specified peripheral(s) as USB CDC Devices

Parameters
devDevice to initialize

◆ Init() [2/2]

void UsbHandle::Init ( UsbPeriph dev)

Initializes the specified peripheral(s) as USB CDC Devices

Parameters
devDevice to initialize

◆ SetReceiveCallback() [1/2]

void UsbHandle::SetReceiveCallback ( ReceiveCallback cb,
UsbPeriph dev )

sets the callback to be called upon reception of new data

Parameters
cbFunction to serve as callback
devDevice to set callback for

◆ SetReceiveCallback() [2/2]

void UsbHandle::SetReceiveCallback ( ReceiveCallback cb,
UsbPeriph dev )

sets the callback to be called upon reception of new data

Parameters
cbFunction to serve as callback
devDevice to set callback for

◆ TransmitExternal() [1/2]

Result UsbHandle::TransmitExternal ( uint8_t * buff,
size_t size )

Transmits a buffer of 'size' bytes from a USB port connected to the external USB Pins of the daisy seed.

Parameters
buffBuffer to transmit
sizeBuffer size

◆ TransmitExternal() [2/2]

Result UsbHandle::TransmitExternal ( uint8_t * buff,
size_t size )

Transmits a buffer of 'size' bytes from a USB port connected to the external USB Pins of the daisy seed.

Parameters
buffBuffer to transmit
sizeBuffer size

◆ TransmitInternal() [1/2]

Result UsbHandle::TransmitInternal ( uint8_t * buff,
size_t size )

Transmits a buffer of 'size' bytes from the on board USB FS port.

Parameters
buffBuffer to transmit
sizeBuffer size

◆ TransmitInternal() [2/2]

Result UsbHandle::TransmitInternal ( uint8_t * buff,
size_t size )

Transmits a buffer of 'size' bytes from the on board USB FS port.

Parameters
buffBuffer to transmit
sizeBuffer size

The documentation for this class was generated from the following file: