}\r
}\r
\r
+bool Pipe_IsEndpointBound(uint8_t EndpointAddress)\r
+{\r
+ uint8_t PrevPipeNumber = Pipe_GetPipeNumber();\r
+\r
+ for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++)\r
+ {\r
+ Pipe_SelectPipe(PNum);\r
+ \r
+ if (Pipe_IsConfigured() && (Pipe_BoundEndpointAddress() == EndpointAddress))\r
+ return true;\r
+ }\r
+ \r
+ Pipe_SelectPipe(PrevPipeNumber);\r
+ return false;\r
+}\r
+\r
uint8_t Pipe_WaitUntilReady(void)\r
{\r
#if (USB_STREAM_TIMEOUT_MS < 0xFF)\r
*/\r
static inline bool Pipe_IsConfigured(void);\r
\r
+ /** Retrieves the endpoint number of the endpoint within the attached device that the currently selected\r
+ * pipe is bound to.\r
+ *\r
+ * \return Endpoint number the currently selected pipe is bound to\r
+ */\r
+ static inline uint8_t Pipe_BoundEndpointNumber(void);\r
+\r
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.\r
*\r
* \param[in] Milliseconds Number of milliseconds between each pipe poll\r
\r
#define Pipe_IsConfigured() ((UPSTAX & (1 << CFGOK)) ? true : false)\r
\r
+ #define Pipe_BoundEndpointNumber() ((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK)\r
+ \r
#define Pipe_SetInterruptPeriod(ms) MACROS{ UPCFG2X = ms; }MACROE\r
\r
#define Pipe_GetPipeInterrupts() UPINT\r
bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber,\r
const uint16_t Size, const uint8_t Banks);\r
\r
- /** Spinloops until the currently selected non-control pipe is ready for the next packed of data\r
- * to be read or written to it.\r
+ /** Spinloops until the currently selected non-control pipe is ready for the next packed of data to be read \r
+ * or written to it, aborting in the case of an error condition (such as a timeout or device disconnect).\r
*\r
* \ingroup Group_PipeRW\r
*\r
* \return A value from the Pipe_WaitUntilReady_ErrorCodes_t enum.\r
*/\r
- uint8_t Pipe_WaitUntilReady(void); \r
+ uint8_t Pipe_WaitUntilReady(void);\r
+ \r
+ /** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given\r
+ * endpoint is found, it is automatically selected.\r
+ *\r
+ * \param EndpointAddress Address of the endpoint within the attached device to check\r
+ *\r
+ * \return Boolean true if a pipe bound to the given endpoint address is found, false otherwise\r
+ */\r
+ bool Pipe_IsEndpointBound(uint8_t EndpointAddress);\r
\r
/** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host\r
* as needed. The last packet is not automatically discarded once the remaining bytes has been read; the\r
* - Added new Endpoint_ClearStatusStage() convenience function to assist with the status stages of control transfers\r
* - Added new Benito Arduino Programmer project\r
* - Added new LEDs_ToggleLEDs() function to the LEDs driver\r
+ * - Added new Pipe_BoundEndpointNumber() and Pipe_IsEndpointBound() functions\r
* \r
* <b>Changed:</b>\r
* - Deprecated psuedo-scheduler and removed dynamic memory allocator from the library (first no longer needed and second unused)\r