Merge branch 'xxxajk' of github.com:felis/USB_Host_Shield_2.0 into xxxajk

This commit is contained in:
Kristian Sloth Lauszus 2013-03-30 17:06:28 +01:00
commit 13bb5c2356
7 changed files with 26 additions and 31 deletions

6
Usb.h
View file

@ -18,10 +18,8 @@ e-mail : support@circuitsathome.com
#ifndef _usb_h_
#define _usb_h_
//#define BOARD_BLACK_WIDDOW
#define USB_METHODS_INLINE
#include <inttypes.h>
@ -39,12 +37,8 @@ e-mail : support@circuitsathome.com
#else
#include <WProgram.h>
#endif
#include "printhex.h"
#include "hexdump.h"
#include "message.h"
extern int UsbDEBUGlvl;
/* shield pins. First parameter - SS pin, second parameter - INT pin */
#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)

View file

@ -20,8 +20,6 @@ e-mail : support@circuitsathome.com
#include <inttypes.h>
#include <avr/pgmspace.h>
#include "printhex.h"
#include "hexdump.h"
#include "message.h"
#include "parsetools.h"

View file

@ -19,7 +19,6 @@ e-mail : support@circuitsathome.com
#include <inttypes.h>
#include <avr/pgmspace.h>
#include "printhex.h"
template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
class HexDumper : public BASE_CLASS {
@ -41,19 +40,23 @@ public:
template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
void HexDumper<BASE_CLASS, LEN_TYPE, OFFSET_TYPE>::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) {
for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) {
if(!byteCount) {
SerialPrintHex<OFFSET_TYPE > (byteTotal);
Serial.print(": ");
}
SerialPrintHex<uint8_t > (pbuf[j]);
Serial.print(" ");
#ifdef DEBUG
if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug.
for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) {
if(!byteCount) {
PrintHex<OFFSET_TYPE > (byteTotal, 0x80);
Notify(PSTR(": "), 0x80);
}
PrintHex<uint8_t > (pbuf[j], 0x80);
Notify(PSTR(" "), 0x80);
if(byteCount == 15) {
Serial.println("");
byteCount = 0xFF;
if(byteCount == 15) {
Notify(PSTR("\r\n"), 0x80);
byteCount = 0xFF;
}
}
}
#endif
}
#endif // __HEXDUMP_H__
#endif // __HEXDUMP_H__

View file

@ -1,5 +1,5 @@
#include "message.h"
#include "masstorage.h"
const uint8_t BulkOnly::epDataInIndex = 1;
const uint8_t BulkOnly::epDataOutIndex = 2;
const uint8_t BulkOnly::epInterruptInIndex = 3;

View file

@ -1,6 +1,8 @@
#if !defined(__MASSTORAGE_H__)
#define __MASSTORAGE_H__
#define DEBUG
#include <inttypes.h>
#include "avrpins.h"
#include <avr/pgmspace.h>
@ -15,10 +17,6 @@
#include <WProgram.h>
#endif
#include "printhex.h"
#include "hexdump.h"
#include "message.h"
#include <confdescparser.h>
#define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))

View file

@ -14,6 +14,8 @@ Circuits At Home, LTD
Web : http://www.circuitsathome.com
e-mail : support@circuitsathome.com
*/
#define DEBUG
#include "message.h"
// 0x80 is the default (i.e. trace) to turn off set this global to something lower.
// this allows for 126 other debugging levels.
@ -46,7 +48,6 @@ void NotifyStr(char const * msg, int lvl) {
while (c = *msg++) Notifyc(c, lvl);
}
#ifdef DEBUG
void NotifyFailGetDevDescr(void) {
Notify(PSTR("\r\ngetDevDescr"), 0x80);
}
@ -58,7 +59,7 @@ void NotifyFailGetConfDescr(void) {
Notify(PSTR("\r\ngetConf"), 0x80);
}
void NotifyFailSetConf(void) {
void NotifyFailSetConfDescr(void) {
Notify(PSTR("\r\nsetConf"), 0x80);
}
@ -73,4 +74,3 @@ void NotifyFail(uint8_t rcode) {
PrintHex<uint8_t > (rcode, 0x80);
Notify(PSTR("\r\n"), 0x80);
}
#endif

View file

@ -20,6 +20,10 @@ e-mail : support@circuitsathome.com
#include <inttypes.h>
#include <avr/pgmspace.h>
extern int UsbDEBUGlvl;
#include "printhex.h"
void Notify(char const * msg, int lvl);
void NotifyStr(char const * msg, int lvl);
#ifdef DEBUG
@ -37,9 +41,6 @@ void NotifyFail(uint8_t rcode);
#define NotifyFailUnknownDevice(VID, PID)
#define NotifyFail(rcode)
#endif
extern int UsbDEBUGlvl;
#include "printhex.h"
template <class ERROR_TYPE>
void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) {
@ -49,5 +50,6 @@ void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) {
Notify(PSTR("\r\n"), 0x80);
}
#include "hexdump.h"
#endif // __MESSAGE_H__