1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
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
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
17 #if !defined(_usb_h_) || defined(__MESSAGE_H__)
18 #error "Never include message.h directly; include Usb.h instead"
22 extern int UsbDEBUGlvl;
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);
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);
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)
58 template <class ERROR_TYPE>
59 void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) {
62 Notify(PSTR(": "), level);
63 D_PrintHex<ERROR_TYPE > (rcode, level);
64 Notify(PSTR("\r\n"), level);
68 template <class ERROR_TYPE>
69 void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) {
72 Notify(PSTR(": "), 0x80);
73 D_PrintHex<ERROR_TYPE > (rcode, 0x80);
74 Notify(PSTR("\r\n"), 0x80);
78 #endif // __MESSAGE_H__