mirror of
https://github.com/gdsports/USBHost_t36
synced 2024-11-28 03:52:14 -05:00
Add define to enable/disable all debug printing
This commit is contained in:
parent
0443ab8db6
commit
b18ee4ea06
33
USBHost.h
33
USBHost.h
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define USBHOST_PRINT_DEBUG
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* Data Structure Definitions */
|
/* Data Structure Definitions */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
@ -182,6 +184,7 @@ private:
|
|||||||
uint32_t maxlen, uint32_t interval);
|
uint32_t maxlen, uint32_t interval);
|
||||||
static void add_qh_to_periodic_schedule(Pipe_t *pipe);
|
static void add_qh_to_periodic_schedule(Pipe_t *pipe);
|
||||||
protected:
|
protected:
|
||||||
|
#ifdef USBHOST_PRINT_DEBUG
|
||||||
static void print(const Transfer_t *transfer);
|
static void print(const Transfer_t *transfer);
|
||||||
static void print(const Transfer_t *first, const Transfer_t *last);
|
static void print(const Transfer_t *first, const Transfer_t *last);
|
||||||
static void print_token(uint32_t token);
|
static void print_token(uint32_t token);
|
||||||
@ -218,6 +221,36 @@ protected:
|
|||||||
Serial.print(s); Serial.println(n, b); }
|
Serial.print(s); Serial.println(n, b); }
|
||||||
static void println(const char *s, unsigned long n, uint8_t b) {
|
static void println(const char *s, unsigned long n, uint8_t b) {
|
||||||
Serial.print(s); Serial.println(n, b); }
|
Serial.print(s); Serial.println(n, b); }
|
||||||
|
#else
|
||||||
|
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_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 println(const char *s, int n) {}
|
||||||
|
static void println(const char *s, unsigned int n) {}
|
||||||
|
static void println(const char *s, long n) {}
|
||||||
|
static void println(const char *s, unsigned long n) {}
|
||||||
|
static void println(const char *s, int n, uint8_t b) {}
|
||||||
|
static void println(const char *s, unsigned int n, uint8_t b) {}
|
||||||
|
static void println(const char *s, long n, uint8_t b) {}
|
||||||
|
static void println(const char *s, unsigned long n, uint8_t b) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void mk_setup(setup_t &s, uint32_t bmRequestType, uint32_t bRequest,
|
static void mk_setup(setup_t &s, uint32_t bmRequestType, uint32_t bRequest,
|
||||||
uint32_t wValue, uint32_t wIndex, uint32_t wLength) {
|
uint32_t wValue, uint32_t wIndex, uint32_t wLength) {
|
||||||
|
2
ehci.cpp
2
ehci.cpp
@ -347,12 +347,14 @@ void USBHost::isr()
|
|||||||
|
|
||||||
void USBDriverTimer::start(uint32_t microseconds)
|
void USBDriverTimer::start(uint32_t microseconds)
|
||||||
{
|
{
|
||||||
|
#ifdef USBHOST_PRINT_DEBUG
|
||||||
Serial.print("start_timer, us = ");
|
Serial.print("start_timer, us = ");
|
||||||
Serial.print(microseconds);
|
Serial.print(microseconds);
|
||||||
Serial.print(", driver = ");
|
Serial.print(", driver = ");
|
||||||
Serial.print((uint32_t)driver, HEX);
|
Serial.print((uint32_t)driver, HEX);
|
||||||
Serial.print(", this = ");
|
Serial.print(", this = ");
|
||||||
Serial.println((uint32_t)this, HEX);
|
Serial.println((uint32_t)this, HEX);
|
||||||
|
#endif
|
||||||
if (!driver) return;
|
if (!driver) return;
|
||||||
if (microseconds < 100) return; // minimum timer duration
|
if (microseconds < 100) return; // minimum timer duration
|
||||||
started_micros = micros();
|
started_micros = micros();
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "USBHost.h"
|
#include "USBHost.h"
|
||||||
|
|
||||||
|
#ifdef USBHOST_PRINT_DEBUG
|
||||||
|
|
||||||
void USBHost::print(const Transfer_t *transfer)
|
void USBHost::print(const Transfer_t *transfer)
|
||||||
{
|
{
|
||||||
@ -178,3 +179,4 @@ void USBHost::print_hexbytes(const void *ptr, uint32_t len)
|
|||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user