PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
USB Device Middleware: Printer Class

Macros

#define BUFFER_SIZE_ENDPOINTOUT   512
 

Typedefs

typedef void(* usbdeviceprinter_datareceived_func_ptr_t )(uint8_t *pu8DataBuffer, uint32_t u32DataLength)
 
typedef void(* usbdeviceprinter_datasent_func_ptr_t )(void)
 

Functions

void UsbDevicePrinter_Init (stc_usbn_t *pstcUsb)
 
uint32_t UsbDevicePrinter_GetReceivedData (uint8_t **ppu8Buffer)
 
boolean_t UsbDevicePrinter_SendData (stc_usbn_t *pstcUsb, uint8_t *pu8Buffer, uint32_t u32DataSize, en_usbsend_mode_t enMode)
 
uint8_t UsbDevicePrinter_DataSent (void)
 
void UsbDevicePrinter_SetReceivedCallback (usbdeviceprinter_datareceived_func_ptr_t pstnCallback)
 
void UsbDevicePrinter_SetSentCallback (usbdeviceprinter_datasent_func_ptr_t pstnCallback)
 

Detailed Description

Provided functions of USB Device Printer module:

Used to enumerate printe class

Macro Definition Documentation

#define BUFFER_SIZE_ENDPOINTOUT   512

Definition at line 101 of file UsbDevicePrinter.h.

Referenced by UsbDevicePrinter_Init(), and UsbDevicePrinter_RxCallback().

Typedef Documentation

typedef void(* usbdeviceprinter_datareceived_func_ptr_t)(uint8_t *pu8DataBuffer, uint32_t u32DataLength)

Definition at line 110 of file UsbDevicePrinter.h.

typedef void(* usbdeviceprinter_datasent_func_ptr_t)(void)

Definition at line 111 of file UsbDevicePrinter.h.

Function Documentation

uint8_t UsbDevicePrinter_DataSent ( void  )

Is used to use get the sent status of endpoint

Definition at line 294 of file UsbDevicePrinter.c.

References DataSentFlags.

uint32_t UsbDevicePrinter_GetReceivedData ( uint8_t **  ppu8Buffer)

Is used to use received data from endpoint

Parameters
ppu8Bufferpointer to buffer

Definition at line 236 of file UsbDevicePrinter.c.

References DataReceivedFlags, stc_usbn_endpoint_data::pstcEndpointBuffer, stc_usbn_endpoint_buffer::pu8Buffer, and u32LastReceivedSize.

boolean_t UsbDevicePrinter_SendData ( stc_usbn_t *  pstcUsb,
uint8_t *  pu8Buffer,
uint32_t  u32DataSize,
en_usbsend_mode_t  enMode 
)

Is called from main application to send data via endpoint

Parameters
pstcUsbUSB Handle
pu8BufferBuffer to send
u32DataSizeBuffersize
enModepolled sending, interrupt sending or DMA
Returns
1: if succesful, 0: if usb was not ready

Definition at line 258 of file UsbDevicePrinter.c.

References DataSentFlags, FALSE, TRUE, UsbConfigured, UsbDevice_GetStatus(), UsbDevice_SendData(), and UsbPOLL.

Here is the call graph for this function:

void UsbDevicePrinter_SetReceivedCallback ( usbdeviceprinter_datareceived_func_ptr_t  pstnCallback)

Set received callback

Parameters
pstnCallbackcallback handle

Definition at line 176 of file UsbDevicePrinter.c.

References pstnReceivedData.

void UsbDevicePrinter_SetSentCallback ( usbdeviceprinter_datasent_func_ptr_t  pstnCallback)

Set sent callback

Parameters
pstnCallbackcallback handle

Definition at line 188 of file UsbDevicePrinter.c.

References pstnSentData.