Checkm8-a5/usb_host_tch At Master - GitHub

Skip to content Dismiss alert {{ message }} / checkm8-a5 Public
  • Notifications You must be signed in to change notification settings
  • Fork 145
  • Star 183
  • Code
  • Issues 19
  • Pull requests 1
  • Actions
  • Projects
  • Security
  • Insights
Additional navigation options

Files

 master

Breadcrumbs

  1. checkm8-a5
usb_host_library.patchBlameBlame

Latest commit

 

History

History73 lines (66 loc) · 3.2 KB master
  1. checkm8-a5
usb_host_library.patchTop

File metadata and controls

  • Code
  • Blame
73 lines (66 loc) · 3.2 KBRaw12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273diff --git a/Usb.cpp b/Usb.cppindex 7843d49b..1736914b 100644--- a/Usb.cpp+++ b/Usb.cpp@@ -201,6 +201,37 @@ uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bReque return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction } +uint8_t USB::ctrlReq_SETUP(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,+ uint16_t wInd, uint16_t total) {+ bool direction = false; //request direction, IN or OUT+ uint8_t rcode;+ SETUP_PKT setup_pkt;++ EpInfo *pep = NULL;+ uint16_t nak_limit = 0;++ rcode = SetAddress(addr, ep, &pep, &nak_limit);++ if(rcode)+ return rcode;++ direction = ((bmReqType & 0x80) > 0);++ /* fill in setup packet */+ setup_pkt.ReqType_u.bmRequestType = bmReqType;+ setup_pkt.bRequest = bRequest;+ setup_pkt.wVal_u.wValueLo = wValLo;+ setup_pkt.wVal_u.wValueHi = wValHi;+ setup_pkt.wIndex = wInd;+ setup_pkt.wLength = total;++ bytesWr(rSUDFIFO, 8, (uint8_t*) & setup_pkt); //transfer to setup packet FIFO++ rcode = dispatchPkt(tokSETUP, ep, nak_limit); //dispatch packet++ return rcode;+}+ /* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */ /* Keep sending INs and writes data to memory area pointed by 'data' */ @@ -540,7 +571,7 @@ void USB::Task(void) //USB state machine //Serial.print("\r\nConf.LS: "); //Serial.println(lowspeed, HEX); - rcode = Configuring(0, 0, lowspeed);+ rcode = 0; // Configuring(0, 0, lowspeed); if(rcode) { if(rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) {diff --git a/UsbCore.h b/UsbCore.hindex 8574d29c..7c9cbef6 100644--- a/UsbCore.h+++ b/UsbCore.h@@ -104,7 +104,7 @@ typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega #define USB_ERROR_FailGetConfDescr 0xE3 #define USB_ERROR_TRANSFER_TIMEOUT 0xFF -#define USB_XFER_TIMEOUT 5000 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec+#define USB_XFER_TIMEOUT 12 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec //#define USB_NAK_LIMIT 32000 // NAK limit for a transfer. 0 means NAKs are not counted #define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer #define USB_SETTLE_DELAY 200 // settle delay in milliseconds@@ -270,6 +270,8 @@ public: uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p);+ uint8_t ctrlReq_SETUP(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,+ uint16_t wInd, uint16_t total); private: void init(); You can’t perform that action at this time.

Từ khóa » Checkm8-a5 Github