aboutsummaryrefslogtreecommitdiff
path: root/lib/usbhost/USB_Host_Shield_2.0/message.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/usbhost/USB_Host_Shield_2.0/message.h')
-rw-r--r--lib/usbhost/USB_Host_Shield_2.0/message.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/usbhost/USB_Host_Shield_2.0/message.h b/lib/usbhost/USB_Host_Shield_2.0/message.h
new file mode 100644
index 000000000..c26628e7f
--- /dev/null
+++ b/lib/usbhost/USB_Host_Shield_2.0/message.h
@@ -0,0 +1,78 @@
1/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2
3This software may be distributed and modified under the terms of the GNU
4General Public License version 2 (GPL2) as published by the Free Software
5Foundation and appearing in the file GPL2.TXT included in the packaging of
6this file. Please note that GPL2 Section 2[b] requires that all works based
7on this software must also be made publicly available under the terms of
8the GPL2 ("Copyleft").
9
10Contact information
11-------------------
12
13Circuits At Home, LTD
14Web : http://www.circuitsathome.com
15e-mail : support@circuitsathome.com
16 */
17#if !defined(_usb_h_) || defined(__MESSAGE_H__)
18#error "Never include message.h directly; include Usb.h instead"
19#else
20#define __MESSAGE_H__
21
22extern int UsbDEBUGlvl;
23
24void E_Notify(char const * msg, int lvl);
25void E_Notify(uint8_t b, int lvl);
26void E_NotifyStr(char const * msg, int lvl);
27void E_Notifyc(char c, int lvl);
28
29#ifdef DEBUG_USB_HOST
30#define Notify E_Notify
31#define NotifyStr E_NotifyStr
32#define Notifyc E_Notifyc
33void NotifyFailGetDevDescr(uint8_t reason);
34void NotifyFailSetDevTblEntry(uint8_t reason);
35void NotifyFailGetConfDescr(uint8_t reason);
36void NotifyFailSetConfDescr(uint8_t reason);
37void NotifyFailGetDevDescr(void);
38void NotifyFailSetDevTblEntry(void);
39void NotifyFailGetConfDescr(void);
40void NotifyFailSetConfDescr(void);
41void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID);
42void NotifyFail(uint8_t rcode);
43#else
44#define Notify(...) ((void)0)
45#define NotifyStr(...) ((void)0)
46#define Notifyc(...) ((void)0)
47#define NotifyFailGetDevDescr(...) ((void)0)
48#define NotifyFailSetDevTblEntry(...) ((void)0)
49#define NotifyFailGetConfDescr(...) ((void)0)
50#define NotifyFailGetDevDescr(...) ((void)0)
51#define NotifyFailSetDevTblEntry(...) ((void)0)
52#define NotifyFailGetConfDescr(...) ((void)0)
53#define NotifyFailSetConfDescr(...) ((void)0)
54#define NotifyFailUnknownDevice(...) ((void)0)
55#define NotifyFail(...) ((void)0)
56#endif
57
58template <class ERROR_TYPE>
59void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) {
60#ifdef DEBUG_USB_HOST
61 Notify(msg, level);
62 Notify(PSTR(": "), level);
63 D_PrintHex<ERROR_TYPE > (rcode, level);
64 Notify(PSTR("\r\n"), level);
65#endif
66}
67
68template <class ERROR_TYPE>
69void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) {
70#ifdef DEBUG_USB_HOST
71 Notify(msg, 0x80);
72 Notify(PSTR(": "), 0x80);
73 D_PrintHex<ERROR_TYPE > (rcode, 0x80);
74 Notify(PSTR("\r\n"), 0x80);
75#endif
76}
77
78#endif // __MESSAGE_H__