USB Host Shield 2.0
message.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This software may be distributed and modified under the terms of the GNU
4 General Public License version 2 (GPL2) as published by the Free Software
5 Foundation and appearing in the file GPL2.TXT included in the packaging of
6 this file. Please note that GPL2 Section 2[b] requires that all works based
7 on this software must also be made publicly available under the terms of
8 the GPL2 ("Copyleft").
9 
10 Contact information
11 -------------------
12 
13 Circuits At Home, LTD
14 Web : http://www.circuitsathome.com
15 e-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 
22 extern int UsbDEBUGlvl;
23 
24 void E_Notify(char const * msg, int lvl);
25 void E_Notify(uint8_t b, int lvl);
26 void E_NotifyStr(char const * msg, int lvl);
27 void 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
33 void NotifyFailGetDevDescr(uint8_t reason);
34 void NotifyFailSetDevTblEntry(uint8_t reason);
35 void NotifyFailGetConfDescr(uint8_t reason);
36 void NotifyFailSetConfDescr(uint8_t reason);
37 void NotifyFailGetDevDescr(void);
38 void NotifyFailSetDevTblEntry(void);
39 void NotifyFailGetConfDescr(void);
40 void NotifyFailSetConfDescr(void);
41 void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID);
42 void 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 
58 template <class ERROR_TYPE>
59 void 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 
68 template <class ERROR_TYPE>
69 void 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__
void E_Notify(char const *msg, int lvl)
Definition: message.cpp:34
#define NotifyFail(...)
Definition: message.h:55
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
void E_NotifyStr(char const *msg, int lvl)
Definition: message.cpp:42
#define Notify(...)
Definition: message.h:44
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
#define NotifyFailUnknownDevice(...)
Definition: message.h:54
void E_Notifyc(char c, int lvl)
Definition: message.cpp:24
#define PSTR(str)
int UsbDEBUGlvl
Definition: message.cpp:22
void ErrorMessage(uint8_t level, char const *msg, ERROR_TYPE rcode=0)
Definition: message.h:59
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51