mirror of
https://github.com/gdsports/USBHost_t36
synced 2024-11-21 08:35:03 -05:00
Fix print() & println() conflict with Arduino Print class
This commit is contained in:
parent
b82efa836e
commit
f1bb020282
@ -270,71 +270,72 @@ private:
|
||||
static void followup_Error(void);
|
||||
protected:
|
||||
#ifdef USBHOST_PRINT_DEBUG
|
||||
static void print(const Transfer_t *transfer);
|
||||
static void print(const Transfer_t *first, const Transfer_t *last);
|
||||
static void print_(const Transfer_t *transfer);
|
||||
static void print_(const Transfer_t *first, const Transfer_t *last);
|
||||
static void print_token(uint32_t token);
|
||||
static void print(const Pipe_t *pipe);
|
||||
static void print_(const Pipe_t *pipe);
|
||||
static void print_driverlist(const char *name, const USBDriver *driver);
|
||||
static void print_qh_list(const Pipe_t *list);
|
||||
static void print_hexbytes(const void *ptr, uint32_t len);
|
||||
static void print(const char *s) { Serial.print(s); }
|
||||
static void print(int n) { Serial.print(n); }
|
||||
static void print(unsigned int n) { Serial.print(n); }
|
||||
static void print(long n) { Serial.print(n); }
|
||||
static void print(unsigned long n) { Serial.print(n); }
|
||||
static void println(const char *s) { Serial.println(s); }
|
||||
static void println(int n) { Serial.println(n); }
|
||||
static void println(unsigned int n) { Serial.println(n); }
|
||||
static void println(long n) { Serial.println(n); }
|
||||
static void println(unsigned long n) { Serial.println(n); }
|
||||
static void println() { Serial.println(); }
|
||||
static void print(uint32_t n, uint8_t b) { Serial.print(n, b); }
|
||||
static void println(uint32_t n, uint8_t b) { Serial.println(n, b); }
|
||||
static void print(const char *s, int n, uint8_t b = DEC) {
|
||||
static void print_(const char *s) { Serial.print(s); }
|
||||
static void print_(int n) { Serial.print(n); }
|
||||
static void print_(unsigned int n) { Serial.print(n); }
|
||||
static void print_(long n) { Serial.print(n); }
|
||||
static void print_(unsigned long n) { Serial.print(n); }
|
||||
static void println_(const char *s) { Serial.println(s); }
|
||||
static void println_(int n) { Serial.println(n); }
|
||||
static void println_(unsigned int n) { Serial.println(n); }
|
||||
static void println_(long n) { Serial.println(n); }
|
||||
static void println_(unsigned long n) { Serial.println(n); }
|
||||
static void println_() { Serial.println(); }
|
||||
static void print_(uint32_t n, uint8_t b) { Serial.print(n, b); }
|
||||
static void println_(uint32_t n, uint8_t b) { Serial.println(n, b); }
|
||||
static void print_(const char *s, int n, uint8_t b = DEC) {
|
||||
Serial.print(s); Serial.print(n, b); }
|
||||
static void print(const char *s, unsigned int n, uint8_t b = DEC) {
|
||||
static void print_(const char *s, unsigned int n, uint8_t b = DEC) {
|
||||
Serial.print(s); Serial.print(n, b); }
|
||||
static void print(const char *s, long n, uint8_t b = DEC) {
|
||||
static void print_(const char *s, long n, uint8_t b = DEC) {
|
||||
Serial.print(s); Serial.print(n, b); }
|
||||
static void print(const char *s, unsigned long n, uint8_t b = DEC) {
|
||||
static void print_(const char *s, unsigned long n, uint8_t b = DEC) {
|
||||
Serial.print(s); Serial.print(n, b); }
|
||||
static void println(const char *s, int n, uint8_t b = DEC) {
|
||||
static void println_(const char *s, int n, uint8_t b = DEC) {
|
||||
Serial.print(s); Serial.println(n, b); }
|
||||
static void println(const char *s, unsigned int n, uint8_t b = DEC) {
|
||||
static void println_(const char *s, unsigned int n, uint8_t b = DEC) {
|
||||
Serial.print(s); Serial.println(n, b); }
|
||||
static void println(const char *s, long n, uint8_t b = DEC) {
|
||||
static void println_(const char *s, long n, uint8_t b = DEC) {
|
||||
Serial.print(s); Serial.println(n, b); }
|
||||
static void println(const char *s, unsigned long n, uint8_t b = DEC) {
|
||||
static void println_(const char *s, unsigned long n, uint8_t b = DEC) {
|
||||
Serial.print(s); Serial.println(n, b); }
|
||||
friend class USBDriverTimer; // for access to print & println
|
||||
#else
|
||||
static void print(const Transfer_t *transfer) {}
|
||||
static void print(const Transfer_t *first, const Transfer_t *last) {}
|
||||
static void print_(const Transfer_t *transfer) {}
|
||||
static void print_(const Transfer_t *first, const Transfer_t *last) {}
|
||||
static void print_token(uint32_t token) {}
|
||||
static void print(const Pipe_t *pipe) {}
|
||||
static void print_(const Pipe_t *pipe) {}
|
||||
static void print_driverlist(const char *name, const USBDriver *driver) {}
|
||||
static void print_qh_list(const Pipe_t *list) {}
|
||||
static void print_hexbytes(const void *ptr, uint32_t len) {}
|
||||
static void print(const char *s) {}
|
||||
static void print(int n) {}
|
||||
static void print(unsigned int n) {}
|
||||
static void print(long n) {}
|
||||
static void print(unsigned long n) {}
|
||||
static void println(const char *s) {}
|
||||
static void println(int n) {}
|
||||
static void println(unsigned int n) {}
|
||||
static void println(long n) {}
|
||||
static void println(unsigned long n) {}
|
||||
static void println() {}
|
||||
static void print(uint32_t n, uint8_t b) {}
|
||||
static void println(uint32_t n, uint8_t b) {}
|
||||
static void print(const char *s, int n, uint8_t b = DEC) {}
|
||||
static void print(const char *s, unsigned int n, uint8_t b = DEC) {}
|
||||
static void print(const char *s, long n, uint8_t b = DEC) {}
|
||||
static void print(const char *s, unsigned long n, uint8_t b = DEC) {}
|
||||
static void println(const char *s, int n, uint8_t b = DEC) {}
|
||||
static void println(const char *s, unsigned int n, uint8_t b = DEC) {}
|
||||
static void println(const char *s, long n, uint8_t b = DEC) {}
|
||||
static void println(const char *s, unsigned long n, uint8_t b = DEC) {}
|
||||
static void print_(const char *s) {}
|
||||
static void print_(int n) {}
|
||||
static void print_(unsigned int n) {}
|
||||
static void print_(long n) {}
|
||||
static void print_(unsigned long n) {}
|
||||
static void println_(const char *s) {}
|
||||
static void println_(int n) {}
|
||||
static void println_(unsigned int n) {}
|
||||
static void println_(long n) {}
|
||||
static void println_(unsigned long n) {}
|
||||
static void println_() {}
|
||||
static void print_(uint32_t n, uint8_t b) {}
|
||||
static void println_(uint32_t n, uint8_t b) {}
|
||||
static void print_(const char *s, int n, uint8_t b = DEC) {}
|
||||
static void print_(const char *s, unsigned int n, uint8_t b = DEC) {}
|
||||
static void print_(const char *s, long n, uint8_t b = DEC) {}
|
||||
static void print_(const char *s, unsigned long n, uint8_t b = DEC) {}
|
||||
static void println_(const char *s, int n, uint8_t b = DEC) {}
|
||||
static void println_(const char *s, unsigned int n, uint8_t b = DEC) {}
|
||||
static void println_(const char *s, long n, uint8_t b = DEC) {}
|
||||
static void println_(const char *s, unsigned long n, uint8_t b = DEC) {}
|
||||
#endif
|
||||
static void mk_setup(setup_t &s, uint32_t bmRequestType, uint32_t bRequest,
|
||||
uint32_t wValue, uint32_t wIndex, uint32_t wLength) {
|
||||
|
17
ehci.cpp
17
ehci.cpp
@ -97,6 +97,9 @@ static void remove_from_async_followup_list(Transfer_t *transfer);
|
||||
static void add_to_periodic_followup_list(Transfer_t *first, Transfer_t *last);
|
||||
static void remove_from_periodic_followup_list(Transfer_t *transfer);
|
||||
|
||||
#define print USBHost::print_
|
||||
#define println USBHost::println_
|
||||
|
||||
void USBHost::begin()
|
||||
{
|
||||
// Teensy 3.6 has USB host power controlled by PTE6
|
||||
@ -393,13 +396,13 @@ void USBHost::isr()
|
||||
|
||||
void USBDriverTimer::start(uint32_t microseconds)
|
||||
{
|
||||
#if defined(USBHOST_PRINT_DEBUG) && 0
|
||||
Serial.print("start_timer, us = ");
|
||||
Serial.print(microseconds);
|
||||
Serial.print(", driver = ");
|
||||
Serial.print((uint32_t)driver, HEX);
|
||||
Serial.print(", this = ");
|
||||
Serial.println((uint32_t)this, HEX);
|
||||
#if 0
|
||||
USBHost::print_("start_timer, us = ");
|
||||
USBHost::print_(microseconds);
|
||||
USBHost::print_(", driver = ");
|
||||
USBHost::print_((uint32_t)driver, HEX);
|
||||
USBHost::print_(", this = ");
|
||||
USBHost::println_((uint32_t)this, HEX);
|
||||
#endif
|
||||
if (!driver) return;
|
||||
if (microseconds < 100) return; // minimum timer duration
|
||||
|
@ -58,6 +58,8 @@ volatile bool USBHost::enumeration_busy = false;
|
||||
static void pipe_set_maxlen(Pipe_t *pipe, uint32_t maxlen);
|
||||
static void pipe_set_addr(Pipe_t *pipe, uint32_t addr);
|
||||
|
||||
#define print USBHost::print_
|
||||
#define println USBHost::println_
|
||||
|
||||
// The main user function to cause internal state to update. Since we do
|
||||
// almost everything with DMA and interrupts, the only work to do here is
|
||||
|
3
hid.cpp
3
hid.cpp
@ -32,6 +32,9 @@
|
||||
// callbacks with the arriving data full decoded to data/usage
|
||||
// pairs.
|
||||
|
||||
#define print USBHost::print_
|
||||
#define println USBHost::println_
|
||||
|
||||
void USBHIDParser::init()
|
||||
{
|
||||
contribute_Pipes(mypipes, sizeof(mypipes)/sizeof(Pipe_t));
|
||||
|
3
hub.cpp
3
hub.cpp
@ -29,6 +29,9 @@
|
||||
// begin responding to address zero.
|
||||
volatile bool USBHub::reset_busy = false;
|
||||
|
||||
#define print USBHost::print_
|
||||
#define println USBHost::println_
|
||||
|
||||
void USBHub::init()
|
||||
{
|
||||
contribute_Devices(mydevices, sizeof(mydevices)/sizeof(Device_t));
|
||||
|
@ -89,7 +89,8 @@ keycode_numlock_t keycode_numlock[] = {
|
||||
{M(KEYPAD_PERIOD), 0x80 | M(KEY_DELETE), '.'}
|
||||
};
|
||||
|
||||
|
||||
#define print USBHost::print_
|
||||
#define println USBHost::println_
|
||||
|
||||
void KeyboardController::init()
|
||||
{
|
||||
|
2
midi.cpp
2
midi.cpp
@ -24,6 +24,8 @@
|
||||
#include <Arduino.h>
|
||||
#include "USBHost_t36.h" // Read this header first for key info
|
||||
|
||||
#define print USBHost::print_
|
||||
#define println USBHost::println_
|
||||
|
||||
void MIDIDevice::init()
|
||||
{
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#ifdef USBHOST_PRINT_DEBUG
|
||||
|
||||
void USBHost::print(const Transfer_t *transfer)
|
||||
void USBHost::print_(const Transfer_t *transfer)
|
||||
{
|
||||
if (!((uint32_t)transfer & 0xFFFFFFE0)) return;
|
||||
Serial.print("Transfer @ ");
|
||||
@ -50,7 +50,7 @@ void USBHost::print(const Transfer_t *transfer)
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
void USBHost::print(const Transfer_t *first, const Transfer_t *last)
|
||||
void USBHost::print_(const Transfer_t *first, const Transfer_t *last)
|
||||
{
|
||||
Serial.print("Transfer Followup List ");
|
||||
Serial.print((uint32_t)first, HEX);
|
||||
@ -91,7 +91,7 @@ void USBHost::print_token(uint32_t token)
|
||||
}
|
||||
}
|
||||
|
||||
void USBHost::print(const Pipe_t *pipe)
|
||||
void USBHost::print_(const Pipe_t *pipe)
|
||||
{
|
||||
if (!((uint32_t)pipe & 0xFFFFFFE0)) return;
|
||||
Serial.print("Pipe ");
|
||||
@ -125,7 +125,7 @@ void USBHost::print(const Pipe_t *pipe)
|
||||
Serial.println();
|
||||
const Transfer_t *t = (Transfer_t *)pipe->qh.next;
|
||||
while (((uint32_t)t & 0xFFFFFFE0)) {
|
||||
print(t);
|
||||
print_(t);
|
||||
t = (Transfer_t *)t->qtd.next;
|
||||
}
|
||||
//Serial.print();
|
||||
|
@ -24,10 +24,8 @@
|
||||
#include <Arduino.h>
|
||||
#include "USBHost_t36.h" // Read this header first for key info
|
||||
|
||||
// quick hack - ultimately USBHost print & println need to be renamed
|
||||
#define print USBHost::print
|
||||
#define println USBHost::println
|
||||
|
||||
#define print USBHost::print_
|
||||
#define println USBHost::println_
|
||||
|
||||
/************************************************************/
|
||||
// Initialization and claiming of devices & interfaces
|
||||
|
Loading…
Reference in New Issue
Block a user