/** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's\r
* numerical address in the attached device.\r
*/\r
- #define PIPE_EPNUM_MASK 0x07\r
-\r
- /** Endpoint bank size mask, for masking against endpoint addresses to retrieve the endpoint's\r
- * bank size in the attached device.\r
- */\r
- #define PIPE_EPSIZE_MASK 0x7FF\r
+ #define PIPE_EPNUM_MASK 0x0F\r
\r
/* Pseudo-Function Macros: */\r
#if defined(__DOXYGEN__)\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