57 void (*USBXCORE_apiCallback)(
void);
94 .isSelfPowered = NULL,
104 .numberOfStrings = 4,
105 .callbacks = &callbacks,
115 for (i = 0; i < 18; i++)
117 *((uint8_t*)&USBXCORE_deviceDesc + i) =
118 *((uint8_t*)&USBXCORE_deviceDescInit + i);
122 for (i = 0; i < 32; i++)
128 USBXCORE_deviceDesc.idVendor = p->vendorId;
129 USBXCORE_deviceDesc.idProduct = p->productId;
132 USBXCORE_stringDescTable[0] =
134 USBXCORE_stringDescTable[1] = p->manufacturerString;
135 USBXCORE_stringDescTable[2] = p->productString;
136 USBXCORE_stringDescTable[3] = p->serialString;
139 if(p->maxPower < 0xFA)
145 USBXCORE_deviceDesc.bcdDevice = p->releaseBcd;
150 USBXCORE_apiIntValue = 0;
166 USBXCORE_apiCallback = f;
178 USBXCORE_byteCountOutPtr = countPtr;
179 *USBXCORE_byteCountOutPtr = 0;
186 *block = USBXCORE_overflowBuffer[i];
194 if (((numBytes - USBXCORE_rxOverflowPacketSize) > 0)
195 && (USBXCORE_rxOverflowPacketSize % USB_FS_BULK_EP_MAXSIZE) == 0)
198 USBXCORE_readSize = numBytes;
200 USBXCORE_rxOverflowPacketSize = 0;
210 USBXCORE_rxOverflowPacketSize = 0;
211 USBXCORE_readSize = numBytes;
218 USBXCORE_readSize = numBytes;
230 USBXCORE_byteCountInPtr = countPtr;
231 *USBXCORE_byteCountInPtr = 0;
232 USBXCORE_writeSize = numBytes;
243 USBXCORE_apiIntValue = 0;
266 (*USBXCORE_apiCallback)();
278 USBXCORE_readSize = 0;
279 USBXCORE_writeSize = 0;
282 USBXCORE_rxOverflowPacketSize = 0;
void USBX_apiCallbackDisable(void)
Inhibits user API call-backs and does NOT disable the USB interrupt.
const uint8_t USBXCORE_configDescInit[]
USB Configuration Descriptor.
uint32_t USBXCORE_apiIntValue
Byte holding the current USB_API interrupts.
USB Device stack initialization structure.
bool USBXCORE_zlpActive
Boolean indicating whether a ZLP read is active.
const uint8_t USBXCORE_stringLangDesc[]
USB Language String Descriptor.
#define USB_FS_BULK_EP_MAXSIZE
bool USBXCORE_rxOverflowPacketAvailable
Boolean indicating if data was received while expecting a ZLP.
#define SL_ALIGN(X)
Macro for aligning a variable. Use this macro before the variable definition. X denotes the stora...
void USBX_init(USBX_Init_t *p)
User API USB initialization function.
USB_StringDescriptor_TypeDef const * USBXCORE_stringDescTable[4]
Table of pointers to various string descriptors.
const USBD_UsbResetCb_TypeDef usbReset
const USB_DeviceDescriptor_TypeDef * deviceDescriptor
const uint8_t USBXCORE_buffMult[]
USB Buffer Multiplier.
void USBX_jumpCallback(void)
Conditionally jumps to the user call-back routine.
int USBD_Init(const USBD_Init_TypeDef *p)
Initializes USB device hardware and internal protocol stack data structures, then connects the data-l...
int(* USB_XferCompleteCb_TypeDef)(USB_Status_TypeDef status, uint32_t xferred, uint32_t remaining)
USB transfer callback function.
USBXpress initialization function parameter typedef.
int(* USBD_SetupCmdCb_TypeDef)(const USB_Setup_TypeDef *setup)
USB setup request callback function.
uint32_t * USBXCORE_byteCountOutPtr
Pointer to variable holding number of bytes read.
uint_least16_t USBX_getLibraryVersion(void)
Returns the USBXpress library version.
USB Device stack callback structure.
uint32_t USBXCORE_rxOverflowPacketSize
Size of Rx Overflow Packet.
uint32_t USBXCORE_apiEa
Enable or disable status of USB_API interrupts.
int USBX_SetupCmdCb(const USB_Setup_TypeDef *setup)
USB setup command call-back.
int USBX_blockRead(uint8_t *block, uint32_t numBytes, uint32_t *countPtr)
User API function to get data from host.
Primary header file. Contains internal global declarations and definitions.
int USBX_blockWrite(uint8_t *block, uint32_t numBytes, uint32_t *countPtr)
User API function to send data to host.
uint32_t USBX_getCallbackSource(void)
User API function to get the call-back source.
void(* USBX_apiCallback_t)(void)
uint32_t USBXCORE_readSize
Number of bytes sent to USBX_blockRead() as numBytes.
uint32_t * USBXCORE_byteCountInPtr
Pointer to variable holding number of bytes written.
void USBX_ResetCb(void)
USB Reset call-back.
Header file for the USBXpress firmware library. Includes function prototypes, type definitions...
int USBD_Write(int epAddr, void *data, int byteCount, USB_XferCompleteCb_TypeDef callback)
Start a write (IN) transfer on an endpoint.
void USBD_Stop(void)
Stop USB device stack operation.
void USBX_apiCallbackEnable(USBX_apiCallback_t f)
Enables user API call-backs.
int USBX_inXferCompleteCb(USB_Status_TypeDef, uint16_t, uint16_t remaining)
USBXpress IN Endpoint Transfer Complete Callback.
USBX_BUF(USBXCORE_overflowBuffer, USB_FS_BULK_EP_MAXSIZE)
Buffer to hold overflow rx data if a ZLP read returns more than zero bytes.
USB_DeviceDescriptor_TypeDef USBXCORE_deviceDesc SL_ATTRIBUTE_ALIGN(4)
Copy of device descriptor, so it can be edited.
void USBX_DeviceStateChangeCb(USBD_State_TypeDef oldState, USBD_State_TypeDef newState)
USB device state change call-back.
Header file for USB and VCP Initial Descriptors.
void USBXCORE_resetState(void)
Resets internal USBXpress variables.
void USBX_disable(void)
Disables the USB interface.
int USBX_outXferCompleteCb(USB_Status_TypeDef, uint16_t, uint16_t remaining)
USBXpress OUT Endpoint Transfer Complete Callback.
uint32_t USBXCORE_writeSize
Number of bytes sent to USBX_blockWrite() as numBytes.
uint8_t USBXCORE_configDesc[32]
Copy of configuration descriptor.
#define USBXPRESS_LIBRARY_VERSION
int USBD_Read(int epAddr, void *data, int byteCount, USB_XferCompleteCb_TypeDef callback)
Start a read (OUT) transfer on an endpoint.