Pipe_GetErrorFlags() now returns additional error flags for overflow and underflow...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Pipe.h
index f3da9d1..62cbe65 100644 (file)
 \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
+                       #define PIPE_ERRORFLAG_OVERFLOW         (1 << 6)\r
+\r
+                       /** Mask for \ref Pipe_GetErrorFlags(), indicating that an underflow error occurred in the pipe on the received data. */\r
+                       #define PIPE_ERRORFLAG_UNDERFLOW        (1 << 5)\r
+\r
                        /** Mask for \ref Pipe_GetErrorFlags(), indicating that a CRC error occurred in the pipe on the received data. */\r
                        #define PIPE_ERRORFLAG_CRC16            (1 << 4)\r
 \r
                                \r
                                #define Pipe_ClearErrorFlags()         MACROS{ UPERRX = 0; }MACROE\r
 \r
-                               #define Pipe_GetErrorFlags()           UPERRX\r
+                               #define Pipe_GetErrorFlags()           ((UPERRX & (PIPE_ERRORFLAG_CRC16 | PIPE_ERRORFLAG_TIMEOUT | \\r
+                                                                                  PIPE_ERRORFLAG_PID   | PIPE_ERRORFLAG_DATAPID | \\r
+                                                                                  PIPE_ERRORFLAG_DATATGL))                      | \\r
+                                                                       (UPSTAX & PIPE_ERRORFLAG_OVERFLOW | PIPE_ERRORFLAG_UNDERFLOW))\r
 \r
                                #define Pipe_IsReadWriteAllowed()      ((UPINTX & (1 << RWAL)) ? true : false)\r
 \r