Skip to content

Updated USBHost for library changes #2634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libraries/USBHost/USBHost/USBDeviceConnected.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "USBEndpoint.h"
#include "USBHostConf.h"
#include "rtos.h"
#include "Callback.h"

class USBHostHub;

Expand All @@ -31,7 +32,7 @@ typedef struct {
uint8_t intf_subclass;
uint8_t intf_protocol;
USBEndpoint * ep[MAX_ENDPOINT_PER_INTERFACE];
FunctionPointer detach;
Callback<void()> detach;
char name[10];
} INTERFACE;

Expand Down
4 changes: 2 additions & 2 deletions libraries/USBHost/USBHost/USBEndpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef USBENDPOINT_H
#define USBENDPOINT_H

#include "FunctionPointer.h"
#include "Callback.h"
#include "USBHostTypes.h"
#include "rtos.h"

Expand Down Expand Up @@ -153,7 +153,7 @@ class USBEndpoint
int transferred;
uint8_t * buf_start;

FunctionPointer rx;
Callback<void()> rx;

USBEndpoint* nextEp;

Expand Down
8 changes: 3 additions & 5 deletions libraries/USBHost/USBHost/USBHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,7 @@ void USBHost::usb_process() {
}
}

/* static */void USBHost::usb_process_static(void const * arg) {
((USBHost *)arg)->usb_process();
}

USBHost::USBHost() : usbThread(USBHost::usb_process_static, (void *)this, osPriorityNormal, USB_THREAD_STACK)
USBHost::USBHost() : usbThread(osPriorityNormal, USB_THREAD_STACK)
{
headControlEndpoint = NULL;
headBulkEndpoint = NULL;
Expand Down Expand Up @@ -279,6 +275,8 @@ USBHost::USBHost() : usbThread(USBHost::usb_process_static, (void *)this, osPrio
hub_in_use[i] = false;
}
#endif

usbThread.start(this, &USBHost::usb_process);
}

USBHost::Lock::Lock(USBHost* pHost) : m_pHost(pHost)
Expand Down
1 change: 0 additions & 1 deletion libraries/USBHost/USBHost/USBHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ class USBHost : public USBHALHost {

Thread usbThread;
void usb_process();
static void usb_process_static(void const * arg);
Mail<message_t, 10> mail_usb_event;
Mutex usb_mutex;
Mutex td_mutex;
Expand Down
2 changes: 1 addition & 1 deletion libraries/USBHost/USBHostMSD/USBHostMSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int USBHostMSD::readCapacity() {
if (status == 0) {
blockCount = (result[0] << 24) | (result[1] << 16) | (result[2] << 8) | result[3];
blockSize = (result[4] << 24) | (result[5] << 16) | (result[6] << 8) | result[7];
USB_INFO("MSD [dev: %p] - blockCount: %lld, blockSize: %d, Capacity: %lld\r\n", dev, blockCount, blockSize, blockCount*blockSize);
USB_INFO("MSD [dev: %p] - blockCount: %u, blockSize: %d, Capacity: %d\r\n", dev, blockCount, blockSize, blockCount*blockSize);
}
return status;
}
Expand Down
5 changes: 3 additions & 2 deletions libraries/USBHost/USBHostSerial/USBHostSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "USBHost.h"
#include "Stream.h"
#include "MtxCircBuffer.h"
#include "Callback.h"

/**
* A class to communicate a USB virtual serial port
Expand Down Expand Up @@ -137,8 +138,8 @@ class USBHostSerialPort : public Stream {

void rxHandler();
void txHandler();
FunctionPointer rx;
FunctionPointer tx;
Callback<void()> rx;
Callback<void()> tx;

uint8_t serial_intf;
};
Expand Down