Add bluetooth channel connection callback to the incomplete BluetoothHost demo.
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Pipe.h
index afae6bc..c16822b 100644 (file)
   this software.\r
 */\r
  \r
+/** \file\r
+ *  \brief USB host pipe management definitions.\r
+ *\r
+ *  This file contains structures, function prototypes and macros related to the management of the device's\r
+ *  data pipes when the library is initialized in USB host mode.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the USB driver\r
+ *        dispatch header located in LUFA/Drivers/USB/USB.h.\r
+ */ \r
+\r
 /** \ingroup Group_USB\r
  *  @defgroup Group_PipeManagement Pipe Management\r
  *\r
                        extern "C" {\r
                #endif\r
 \r
+       /* Preprocessor Checks: */\r
+               #if !defined(__INCLUDE_FROM_USB_DRIVER)\r
+                       #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.\r
+               #endif\r
+               \r
        /* Public Interface - May be used in end-application: */\r
                /* Macros: */\r
                        /** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */\r
                         */\r
                        #define PIPE_EPNUM_MASK                 0x0F\r
 \r
+                       /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's\r
+                        *  direction for comparing with the ENDPOINT_DESCRIPTOR_DIR_* masks.\r
+                        */\r
+                       #define PIPE_EPDIR_MASK                 0x80\r
+\r
                /* Pseudo-Function Macros: */\r
                        #if defined(__DOXYGEN__)\r
                                /** Indicates the number of bytes currently stored in the current pipes's selected bank.\r
 \r
                                #define Pipe_IsSETUPSent()             ((UPINTX & (1 << TXSTPI)) ? true : false)\r
 \r
-                               #define Pipe_ClearIN()                 MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << RXINI)); \\r
-                                                                              UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+                               #define Pipe_ClearIN()                 MACROS{ UPINTX &= ~((1 << RXINI) | (1 << FIFOCON)); }MACROE\r
 \r
-                               #define Pipe_ClearOUT()                MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXOUTI)); \\r
-                                                                              UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+                               #define Pipe_ClearOUT()                MACROS{ UPINTX &= ~((1 << TXOUTI) | (1 << FIFOCON)); }MACROE\r
                                \r
-                               #define Pipe_ClearSETUP()              MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXSTPI)); \\r
-                                                                              UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+                               #define Pipe_ClearSETUP()              MACROS{ UPINTX &= ~((1 << TXSTPI) | (1 << FIFOCON)); }MACROE\r
 \r
                                #define Pipe_IsNAKReceived()           ((UPINTX & (1 << NAKEDI)) ? true : false)\r
 \r
                         *  \ref Pipe_SetFiniteINRequests().\r
                         *\r
                         *  \note The default control pipe does not have to be manually configured, as it is automatically\r
-                        *  configured by the library internally.\r
+                        *        configured by the library internally.\r
+                        *        \n\n\r
                         *\r
                         *  \note This routine will select the specified pipe, and the pipe will remain selected once the\r
                         *        routine completes regardless of if the pipe configuration succeeds.\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[in] EndpointAddress Address of the endpoint within the attached device to check\r
+                        *  \param[in] EndpointAddress Address and direction mask 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
+                        *  \return Boolean true if a pipe bound to the given endpoint address of the specified direction is found, false\r
+                        *          otherwise\r
                         */\r
                        bool Pipe_IsEndpointBound(const uint8_t EndpointAddress);\r
                \r