USB Host Shield 2.0
Loading...
Searching...
No Matches
message.h
Go to the documentation of this file.
1/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation; either version 2 of the License, or
6(at your option) any later version.
7
8This program is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY; without even the implied warranty of
10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License
14along with this program; if not, write to the Free Software
15Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17Contact information
18-------------------
19
20Circuits At Home, LTD
21Web : http://www.circuitsathome.com
22e-mail : support@circuitsathome.com
23 */
24#if !defined(_usb_h_) || defined(__MESSAGE_H__)
25#error "Never include message.h directly; include Usb.h instead"
26#else
27#define __MESSAGE_H__
28
29extern int UsbDEBUGlvl;
30
31void E_Notify(char const * msg, int lvl);
32void E_Notify(uint8_t b, int lvl);
33void E_NotifyStr(char const * msg, int lvl);
34void E_Notifyc(char c, int lvl);
35
36#ifdef DEBUG_USB_HOST
37#define Notify E_Notify
38#define NotifyStr E_NotifyStr
39#define Notifyc E_Notifyc
44void NotifyFailGetDevDescr(void);
46void NotifyFailGetConfDescr(void);
47void NotifyFailSetConfDescr(void);
50#else
51#define Notify(...) ((void)0)
52#define NotifyStr(...) ((void)0)
53#define Notifyc(...) ((void)0)
54#define NotifyFailGetDevDescr(...) ((void)0)
55#define NotifyFailSetDevTblEntry(...) ((void)0)
56#define NotifyFailGetConfDescr(...) ((void)0)
57#define NotifyFailGetDevDescr(...) ((void)0)
58#define NotifyFailSetDevTblEntry(...) ((void)0)
59#define NotifyFailGetConfDescr(...) ((void)0)
60#define NotifyFailSetConfDescr(...) ((void)0)
61#define NotifyFailUnknownDevice(...) ((void)0)
62#define NotifyFail(...) ((void)0)
63#endif
64
65template <class ERROR_TYPE>
66void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) {
67#ifdef DEBUG_USB_HOST
69 Notify(PSTR(": "), level);
71 Notify(PSTR("\r\n"), level);
72#endif
73}
74
75template <class ERROR_TYPE>
76void ErrorMessage(char const * msg __attribute__((unused)), ERROR_TYPE rcode __attribute__((unused)) = 0) {
77#ifdef DEBUG_USB_HOST
78 Notify(msg, 0x80);
79 Notify(PSTR(": "), 0x80);
81 Notify(PSTR("\r\n"), 0x80);
82#endif
83}
84
85#endif // __MESSAGE_H__
#define NotifyFailSetConfDescr(...)
Definition message.h:60
#define NotifyFailUnknownDevice(...)
Definition message.h:61
#define NotifyFail(...)
Definition message.h:62
int UsbDEBUGlvl
Definition message.cpp:29
#define Notify(...)
Definition message.h:51
#define NotifyFailGetConfDescr(...)
Definition message.h:56
void E_NotifyStr(char const *msg, int lvl)
Definition message.cpp:49
void ErrorMessage(uint8_t level, char const *msg, ERROR_TYPE rcode=0)
Definition message.h:66
#define NotifyFailSetDevTblEntry(...)
Definition message.h:55
void E_Notify(char const *msg, int lvl)
Definition message.cpp:41
void E_Notifyc(char c, int lvl)
Definition message.cpp:31
#define NotifyFailGetDevDescr(...)
Definition message.h:54
#define PSTR(str)