diff --git a/BTD.h b/BTD.h index a56c1ba4..097b66f6 100755 --- a/BTD.h +++ b/BTD.h @@ -19,7 +19,6 @@ #define _btd_h_ #include "Usb.h" -#include "confdescparser.h" //PID and VID of the Sony PS3 devices #define PS3_VID 0x054C // Sony Corporation diff --git a/PS3USB.h b/PS3USB.h index 92628197..775ce56d 100644 --- a/PS3USB.h +++ b/PS3USB.h @@ -18,12 +18,6 @@ #ifndef _ps3usb_h_ #define _ps3usb_h_ -#if defined(ARDUINO) && ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - #include "Usb.h" #include "PS3Enums.h" @@ -267,7 +261,7 @@ private: */ void onInit(); void (*pFuncOnInit)(void); // Pointer to function called in onInit() - + bool bPollEnable; uint32_t timer; // used to continuously set PS3 Move controller Bulb and rumble values diff --git a/Usb.h b/Usb.h index 7f413a07..16e2ecfc 100644 --- a/Usb.h +++ b/Usb.h @@ -22,11 +22,19 @@ e-mail : support@circuitsathome.com // Not used anymore? //#define USB_METHODS_INLINE //#include +#include +#include +#include #include "settings.h" -#include "address.h" -#include "usbhost.h" +#include "printhex.h" #include "message.h" +#include "hexdump.h" +#include "max3421e.h" +#include "address.h" +#include "avrpins.h" +#include "usb_ch9.h" +#include "usbhost.h" /* shield pins. First parameter - SS pin, second parameter - INT pin */ #ifdef BOARD_BLACK_WIDDOW @@ -268,4 +276,8 @@ inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) { #endif // defined(USB_METHODS_INLINE) + +#include "parsetools.h" +#include "confdescparser.h" + #endif //_usb_h_ diff --git a/XBOXOLD.h b/XBOXOLD.h index b7780b2a..02eadbbc 100644 --- a/XBOXOLD.h +++ b/XBOXOLD.h @@ -18,14 +18,8 @@ #ifndef _xboxold_h_ #define _xboxold_h_ -#if defined(ARDUINO) && ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - #include "Usb.h" - #include "controllerEnums.h" +#include "controllerEnums.h" /* Data Xbox taken from descriptors */ #define EP_MAXPKTSIZE 32 // Max size for data via USB diff --git a/XBOXRECV.h b/XBOXRECV.h index ccce3b4d..c5a7f147 100644 --- a/XBOXRECV.h +++ b/XBOXRECV.h @@ -20,12 +20,6 @@ #ifndef _xboxrecv_h_ #define _xboxrecv_h_ -#if defined(ARDUINO) && ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - #include "Usb.h" #include "xboxEnums.h" @@ -135,7 +129,7 @@ public: /** @name Xbox Controller functions */ /** - * Return the analog value from the joysticks on the controller. + * Return the analog value from the joysticks on the controller. * @param a Either ::LeftHatX, ::LeftHatY, ::RightHatX or ::RightHatY. * @param controller The controller to read from. Default to 0. * @return Returns a signed 16-bit integer. @@ -159,7 +153,7 @@ public: setRumbleOn(0, 0, controller); }; /** - * Turn rumble on. + * Turn rumble on. * @param lValue Left motor (big weight) inside the controller. * @param rValue Right motor (small weight) inside the controller. * @param controller The controller to write to. Default to 0. @@ -182,19 +176,19 @@ public: setLedRaw(0, controller); }; /** - * Turn on a LED by using the ::LED enum. + * Turn on a LED by using the ::LED enum. * @param l ::LED1, ::LED2, ::LED3 and ::LED4 is supported by the Xbox controller. * @param controller The controller to write to. Default to 0. */ void setLedOn(LED l, uint8_t controller = 0); /** - * Turn on a LED by using the ::LED enum. + * Turn on a LED by using the ::LED enum. * @param l ::ALL, ::LED1, ::LED2, ::LED3 and ::LED4 is supported by the Xbox controller. * @param controller The controller to write to. Default to 0. */ void setLedBlink(LED l, uint8_t controller = 0); /** - * Used to set special LED modes supported by the Xbox controller. + * Used to set special LED modes supported by the Xbox controller. * @param lm See ::LEDMode. * @param controller The controller to write to. Default to 0. */ diff --git a/XBOXUSB.h b/XBOXUSB.h index 13f1057f..a11d55a1 100644 --- a/XBOXUSB.h +++ b/XBOXUSB.h @@ -18,12 +18,6 @@ #ifndef _xboxusb_h_ #define _xboxusb_h_ -#if defined(ARDUINO) && ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - #include "Usb.h" #include "xboxEnums.h" diff --git a/address.h b/address.h index eda60a3f..d52fda73 100644 --- a/address.h +++ b/address.h @@ -14,12 +14,12 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -#if !defined(__ADDRESS_H__) + +#if !defined(_usb_h_) || defined(__ADDRESS_H__) +#error "Never include address.h directly; include Usb.h instead" +#else #define __ADDRESS_H__ -#include -#include -#include "max3421e.h" /* NAK powers. To save space in endpoint data structure, amount of retries before giving up and returning 0x4 is stored in */ diff --git a/adk.h b/adk.h index 85742f84..08017f9c 100644 --- a/adk.h +++ b/adk.h @@ -21,12 +21,6 @@ e-mail : support@circuitsathome.com #define _ADK_H_ #include "Usb.h" -#include - -#include "printhex.h" -#include "hexdump.h" - -#include "confdescparser.h" #define ADK_VID 0x18D1 #define ADK_PID 0x2D00 diff --git a/cdcacm.h b/cdcacm.h index a7488ea0..cd0b00c7 100644 --- a/cdcacm.h +++ b/cdcacm.h @@ -18,12 +18,6 @@ e-mail : support@circuitsathome.com #define __CDCACM_H__ #include "Usb.h" -#include - -#include "printhex.h" -#include "hexdump.h" - -#include "confdescparser.h" #define bmREQ_CDCOUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE #define bmREQ_CDCIN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE diff --git a/cdcftdi.h b/cdcftdi.h index 35b157d6..e576e246 100644 --- a/cdcftdi.h +++ b/cdcftdi.h @@ -18,13 +18,6 @@ e-mail : support@circuitsathome.com #define __CDCFTDI_H__ #include "Usb.h" -#include -#include "usbhost.h" - -#include "printhex.h" -#include "hexdump.h" - -#include "confdescparser.h" #define bmREQ_FTDI_OUT 0x40 #define bmREQ_FTDI_IN 0xc0 diff --git a/confdescparser.h b/confdescparser.h index 7fcb6a27..b0c87d31 100644 --- a/confdescparser.h +++ b/confdescparser.h @@ -14,16 +14,12 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -#if !defined(__CONFDESCPARSER_H__) +#if !defined(_usb_h_) || defined(__CONFDESCPARSER_H__) +#error "Never include confdescparser.h directly; include Usb.h instead" +#else + #define __CONFDESCPARSER_H__ -#include - -#include -#include "message.h" -#include "parsetools.h" - -//#include "hid.h" class UsbConfigXtracter { public: diff --git a/hexdump.h b/hexdump.h index 2cba6fa2..cf491d94 100644 --- a/hexdump.h +++ b/hexdump.h @@ -14,14 +14,11 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -#if !defined(__HEXDUMP_H__) +#if !defined(_usb_h_) || defined(__HEXDUMP_H__) +#error "Never include hexdump.h directly; include Usb.h instead" +#else #define __HEXDUMP_H__ -#include -#include -#include "printhex.h" -#include "message.h" - extern int UsbDEBUGlvl; template diff --git a/hid.h b/hid.h index 56c4417e..97d44a83 100644 --- a/hid.h +++ b/hid.h @@ -18,12 +18,6 @@ e-mail : support@circuitsathome.com #define __HID_H__ #include "Usb.h" -#include - -#include "printhex.h" -#include "hexdump.h" - -#include "confdescparser.h" #include "hidusagestr.h" #define DATA_SIZE_MASK 0x03 diff --git a/masstorage.h b/masstorage.h index a7eb0016..9f7b43db 100644 --- a/masstorage.h +++ b/masstorage.h @@ -7,8 +7,6 @@ #endif #include "Usb.h" -#include -#include #define bmREQ_MASSOUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE #define bmREQ_MASSIN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE diff --git a/max3421e.h b/max3421e.h index 21138be4..7986a9b3 100644 --- a/max3421e.h +++ b/max3421e.h @@ -14,11 +14,14 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -/* MAX3421E register/bit names and bitmasks */ +#if !defined(_usb_h_) || defined(_max3421e_h_) +#error "Never include max3421e.h directly; include Usb.h instead" +#else -#ifndef _max3421e_h_ #define _max3421e_h_ +/* MAX3421E register/bit names and bitmasks */ + /* Arduino pin definitions */ /* pin numbers to port numbers */ diff --git a/max_LCD.cpp b/max_LCD.cpp index 1ea842d1..71c2247a 100644 --- a/max_LCD.cpp +++ b/max_LCD.cpp @@ -15,17 +15,7 @@ Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ #include "max_LCD.h" -#include "max3421e.h" - -#include #include -#include - -#if defined(ARDUINO) && ARDUINO >=100 -#include "Arduino.h" -#else -#include -#endif // pin definition and set/clear diff --git a/max_LCD.h b/max_LCD.h index 1cce6fc5..be9f2615 100644 --- a/max_LCD.h +++ b/max_LCD.h @@ -21,9 +21,8 @@ e-mail : support@circuitsathome.com #ifndef _Max_LCD_h_ #define _Max_LCD_h_ -#include -#include "Print.h" #include "Usb.h" +#include "Print.h" // commands #define LCD_CLEARDISPLAY 0x01 diff --git a/message.cpp b/message.cpp index 6a4f021f..1ac73f48 100644 --- a/message.cpp +++ b/message.cpp @@ -15,7 +15,7 @@ Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -#include "message.h" +#include "Usb.h" // 0x80 is the default (i.e. trace) to turn off set this global to something lower. // this allows for 126 other debugging levels. // TO-DO: Allow assignment to a different serial port diff --git a/message.h b/message.h index 9c4c1624..74e8af98 100644 --- a/message.h +++ b/message.h @@ -14,16 +14,13 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -#if !defined(__MESSAGE_H__) +#if !defined(_usb_h_) || defined(__MESSAGE_H__) +#error "Never include message.h directly; include Usb.h instead" +#else #define __MESSAGE_H__ -#include "settings.h" -#include -#include - extern int UsbDEBUGlvl; -#include "printhex.h" void E_Notify(char const * msg, int lvl); void E_Notify(uint8_t b, int lvl); void E_NotifyStr(char const * msg, int lvl); @@ -78,6 +75,6 @@ void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) { #endif } -#include "hexdump.h" +//#include "hexdump.h" #endif // __MESSAGE_H__ diff --git a/parsetools.cpp b/parsetools.cpp index c302dd2a..0918abef 100644 --- a/parsetools.cpp +++ b/parsetools.cpp @@ -14,7 +14,7 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -#include "parsetools.h" +#include "Usb.h" bool MultiByteValueParser::Parse(uint8_t **pp, uint16_t *pcntdn) { if (!pBuf) { diff --git a/parsetools.h b/parsetools.h index 59d2ed91..a0f50893 100644 --- a/parsetools.h +++ b/parsetools.h @@ -14,20 +14,10 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -#if !defined(__PARSETOOLS_H__) -#define __PARSETOOLS_H__ - -#include -#include -#include "message.h" -//#include "printhex.h" -//#include "hexdump.h" - -#if defined(ARDUINO) && ARDUINO >=100 -#include "Arduino.h" +#if !defined(_usb_h_) || defined(__PARSETOOLS_H__) +#error "Never include parsetools.h directly; include Usb.h instead" #else -#include -#endif +#define __PARSETOOLS_H__ struct MultiValueBuffer { uint8_t valueSize; diff --git a/printhex.h b/printhex.h index cf57fc1a..ed495ce9 100644 --- a/printhex.h +++ b/printhex.h @@ -14,10 +14,11 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ -#if !defined(__PRINTHEX_H__) -#define __PRINTHEX_H__ -#include "settings.h" +#if !defined(_usb_h_) || defined(__PRINTHEX_H__) +#error "Never include printhex.h directly; include Usb.h instead" +#else +#define __PRINTHEX_H__ void E_Notifyc(char c, int lvl); diff --git a/settings.h b/settings.h index 5fc1702d..ffe54dfe 100644 --- a/settings.h +++ b/settings.h @@ -33,9 +33,6 @@ #endif - - - //////////////////////////////////////////////////////////////////////////////// // AUTOMATIC Settings //////////////////////////////////////////////////////////////////////////////// @@ -48,6 +45,7 @@ #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) #define BOARD_TEENSY_PLUS_PLUS #endif +#include #endif /* SETTINGS_H */ diff --git a/usb_ch9.h b/usb_ch9.h index dd854f5c..2281ada6 100644 --- a/usb_ch9.h +++ b/usb_ch9.h @@ -18,8 +18,6 @@ e-mail : support@circuitsathome.com #ifndef _ch9_h_ #define _ch9_h_ -#include - /* Misc.USB constants */ #define DEV_DESCR_LEN 18 //device descriptor length #define CONF_DESCR_LEN 9 //configuration descriptor length diff --git a/usbhost.h b/usbhost.h index a0000680..f5203e30 100644 --- a/usbhost.h +++ b/usbhost.h @@ -15,13 +15,13 @@ Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ /* MAX3421E-based USB Host Library header file */ -#ifndef _USBHOST_H_ + + +#if !defined(_usb_h_) || defined(_USBHOST_H_) +#error "Never include usbhost.h directly; include Usb.h instead" +#else #define _USBHOST_H_ -#include "avrpins.h" -#include "max3421e.h" -#include "usb_ch9.h" -#include /* SPI initialization */ template< typename CLK, typename MOSI, typename MISO, typename SPI_SS > class SPi { public: diff --git a/usbhub.h b/usbhub.h index 94427b88..2fc5ff64 100644 --- a/usbhub.h +++ b/usbhub.h @@ -18,7 +18,6 @@ e-mail : support@circuitsathome.com #define __USBHUB_H__ #include "Usb.h" -#include #define USB_DESCRIPTOR_HUB 0x09 // Hub descriptor type