Skip to content

UsbHandle

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

#include <usb.h>

Public Types

Name
enum class Result
enum UsbPeriph
enum class Result
enum UsbPeriph
typedef void(*)(uint8_t *buff, uint32_t *len))(uint8_t *buff, uint32_t *len) ReceiveCallback
typedef void(*)(uint8_t *buff, uint32_t *len))(uint8_t *buff, uint32_t *len) ReceiveCallback

Public Functions

Name
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)

Detailed Description

class UsbHandle;

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

Author: Stephen Hensley

Date: December 2019

Public Types Documentation

enum Result

Enumerator Value Description
OK
ERR
OK
ERR

Return values for USBHandle Functions

enum UsbPeriph

Enumerator Value Description
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

Specified which of the two USB Peripherals to initialize.

enum Result

Enumerator Value Description
OK
ERR
OK
ERR

Return values for USBHandle Functions

enum UsbPeriph

Enumerator Value Description
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

Specified which of the two USB Peripherals to initialize.

typedef ReceiveCallback

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

Function called upon reception of a buffer

typedef ReceiveCallback

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

Function called upon reception of a buffer

Public Functions Documentation

function UsbHandle

inline UsbHandle()

function ~UsbHandle

inline ~UsbHandle()

function Init

void Init(
    UsbPeriph dev
)

Parameters:

  • dev Device to initialize

Initializes the specified peripheral(s) as USB CDC Devices


function DeInit

void DeInit(
    UsbPeriph dev
)

Parameters:

  • dev Device to deinitialize

Deinitializes the specified peripheral(s)


function TransmitInternal

Result TransmitInternal(
    uint8_t * buff,
    size_t size
)

Parameters:

  • buff Buffer to transmit
  • size Buffer size

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


function TransmitExternal

Result TransmitExternal(
    uint8_t * buff,
    size_t size
)

Parameters:

  • buff Buffer to transmit
  • size Buffer size

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


function SetReceiveCallback

void SetReceiveCallback(
    ReceiveCallback cb,
    UsbPeriph dev
)

Parameters:

  • cb Function to serve as callback
  • dev Device to set callback for

sets the callback to be called upon reception of new data


function UsbHandle

inline UsbHandle()

function ~UsbHandle

inline ~UsbHandle()

function Init

void Init(
    UsbPeriph dev
)

Parameters:

  • dev Device to initialize

Initializes the specified peripheral(s) as USB CDC Devices


function DeInit

void DeInit(
    UsbPeriph dev
)

Parameters:

  • dev Device to deinitialize

Deinitializes the specified peripheral(s)


function TransmitInternal

Result TransmitInternal(
    uint8_t * buff,
    size_t size
)

Parameters:

  • buff Buffer to transmit
  • size Buffer size

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


function TransmitExternal

Result TransmitExternal(
    uint8_t * buff,
    size_t size
)

Parameters:

  • buff Buffer to transmit
  • size Buffer size

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


function SetReceiveCallback

void SetReceiveCallback(
    ReceiveCallback cb,
    UsbPeriph dev
)

Parameters:

  • cb Function to serve as callback
  • dev Device to set callback for

sets the callback to be called upon reception of new data

---

Updated on 2024-01-03 at 19:41:01 +0000