소스 검색

Add Task function

main
PaulStoffregen 7 년 전
부모
커밋
a805d7552e
3개의 변경된 파일18개의 추가작업 그리고 3개의 파일을 삭제
  1. +8
    -2
      USBHost_t36.h
  2. +8
    -0
      enumeration.cpp
  3. +2
    -1
      k66_usbhost.ino

+ 8
- 2
USBHost_t36.h 파일 보기

@@ -32,8 +32,8 @@
/* Data Types */
/************************************************/

These 6 types are the key to understanding how this USB Host
library really works.
// These 6 types are the key to understanding how this USB Host
// library really works.

// USBHost is a static class controlling the hardware.
// All common USB functionality is implemented here.
@@ -175,6 +175,7 @@ struct Transfer_struct {
class USBHost {
public:
static void begin();
static void Task();
protected:
static Pipe_t * new_Pipe(Device_t *dev, uint32_t type, uint32_t endpoint,
uint32_t direction, uint32_t maxlen, uint32_t interval=0);
@@ -318,6 +319,11 @@ protected:
// a timer event, this function is called.
virtual void timer_event(USBDriverTimer *whichTimer) { }

// When the user calls USBHost::Task, this Task function for all
// active drivers is called, so they may update state and/or call
// any attached user callback functions.
virtual void Task() { }

// When a device disconnects from the USB, this function is called.
// The driver must free all resources it allocated and update any
// internal state necessary to deal with the possibility of user

+ 8
- 0
enumeration.cpp 파일 보기

@@ -40,6 +40,14 @@ static void pipe_set_maxlen(Pipe_t *pipe, uint32_t maxlen);
static void pipe_set_addr(Pipe_t *pipe, uint32_t addr);


void USBHost::Task()
{
for (Device_t *dev = devlist; dev; dev = dev->next) {
for (USBDriver *driver = dev->drivers; driver; driver = driver->next) {
(driver->Task)();
}
}
}

void USBHost::driver_ready_for_device(USBDriver *driver)
{

+ 2
- 1
k66_usbhost.ino 파일 보기

@@ -21,7 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "USBHost.h"
#include "USBHost_t36.h"

USBHost myusb;
USBHub hub1;
@@ -60,6 +60,7 @@ void setup()

void loop()
{
myusb.Task();
}



Loading…
취소
저장