BLE demo for mbed Ported RunningElectronics's SBDBT firmware for BLE. It can communicate with iOS
Dependencies: FatFileSystem mbed
Fork of BTstack by
UsbBaseClass.cpp
00001 #include "UsbBaseClass.h" 00002 //#define __DEBUG 00003 #include "mydbg.h" 00004 00005 UsbBaseClass::UsbBaseClass() 00006 { 00007 if (m_pHost == NULL) { 00008 m_pHost = new UsbHostMgr; 00009 DBG_ASSERT(m_pHost); 00010 m_pHost->init(); 00011 } 00012 DBG("m_pHost=%p\n", m_pHost); 00013 } 00014 00015 UsbErr UsbBaseClass::Usb_poll(int timeout, int timeout2) 00016 { 00017 DBG("%p %d %d\n", this, timeout, timeout2); 00018 Timer t; 00019 t.reset(); 00020 t.start(); 00021 Timer t2; 00022 t2.reset(); 00023 t2.start(); 00024 while(t.read_ms() < timeout) { 00025 UsbErr rc = m_pHost->poll(); 00026 if (rc == USBERR_PROCESSING) { 00027 t2.reset(); 00028 } 00029 if (t2.read_ms() > timeout2) { 00030 DBG("%p t=%d\n", this, t.read_ms()); 00031 return USBERR_OK; 00032 } 00033 wait_ms(50); 00034 } 00035 return USBERR_PROCESSING; 00036 } 00037 00038 UsbHostMgr* UsbBaseClass::m_pHost = NULL;
Generated on Thu Jul 14 2022 15:03:49 by 1.7.2