Improved reliability of USB config interface (port from V5 branch)
[SCSI2SD-V6.git] / src / firmware / hidpacket.c
index 85c42220b36b419e1232ee207f12eb53da7897ee..1f79402a039f57c0685381a0b49f4896b78a959e 100644 (file)
@@ -46,6 +46,12 @@ txReset()
        tx.offset = 0;
 }
 
+void hidPacket_reset()
+{
+    rxReset();
+    txReset();
+}
+
 void hidPacket_recv(const uint8_t* bytes, size_t len)
 {
        if (len < 2)
@@ -141,6 +147,17 @@ void hidPacket_send(const uint8_t* bytes, size_t len)
        }
 }
 
+int
+hidPacket_getHIDBytesReady()
+{
+       if ((tx.state != PARTIAL) || (tx.offset <= 0))
+       {
+               return 0;
+       }
+
+       return 1;
+}
+
 const uint8_t*
 hidPacket_getHIDBytes(uint8_t* hidBuffer)
 {