/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
* irmp.h\r
*\r
- * Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de\r
+ * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irmp.h,v 1.80 2012/11/18 17:51:26 fm Exp $\r
- *\r
- * ATMEGA88 @ 8 MHz\r
+ * $Id: irmp.h,v 1.101 2015/11/18 08:27:50 fm Exp $\r
*\r
* This program is free software; you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
# include "irmpconfig.h"\r
#endif\r
\r
-#if defined (ATMEL_AVR)\r
+#if defined (__AVR_XMEGA__)\r
+# define _CONCAT(a,b) a##b\r
+# define CONCAT(a,b) _CONCAT(a,b)\r
+# define IRMP_PORT_PRE CONCAT(PORT, IRMP_PORT_LETTER)\r
+# define IRMP_DDR_PRE CONCAT(PORT, IRMP_PORT_LETTER)\r
+# define IRMP_PIN_PRE CONCAT(PORT, IRMP_PORT_LETTER)\r
+# define IRMP_PORT IRMP_PORT_PRE.OUT\r
+# define IRMP_DDR IRMP_DDR_PRE.DIR\r
+# define IRMP_PIN IRMP_PIN_PRE.IN\r
+# define IRMP_BIT IRMP_BIT_NUMBER\r
+# define input(x) ((x) & (1 << IRMP_BIT))\r
+\r
+#elif defined (ATMEL_AVR)\r
# define _CONCAT(a,b) a##b\r
# define CONCAT(a,b) _CONCAT(a,b)\r
# define IRMP_PORT CONCAT(PORT, IRMP_PORT_LETTER)\r
# define IRMP_PIN CONCAT(PIN, IRMP_PORT_LETTER)\r
# define IRMP_BIT IRMP_BIT_NUMBER\r
# define input(x) ((x) & (1 << IRMP_BIT))\r
-#elif defined (PIC_C18)\r
-# define input(x) (x)\r
-#elif defined (PIC_CCS)\r
+\r
+#elif defined (PIC_C18) || defined (PIC_CCS)\r
# define input(x) (x)\r
+\r
#elif defined (ARM_STM32)\r
# define _CONCAT(a,b) a##b\r
# define CONCAT(a,b) _CONCAT(a,b)\r
# ifndef USE_STDPERIPH_DRIVER\r
# warning The STM32 port of IRMP uses the ST standard peripheral drivers which are not enabled in your build configuration.\r
# endif\r
+\r
#elif defined (STELLARIS_ARM_CORTEX_M4)\r
# define _CONCAT(a,b) a##b\r
# define CONCAT(a,b) _CONCAT(a,b)\r
# define IRMP_PIN IRMP_PORT_PIN\r
# define input(x) ((uint8_t)(ROM_GPIOPinRead(IRMP_PORT_BASE, IRMP_PORT_PIN)))\r
# define sei() IntMasterEnable()\r
+\r
+#elif defined(__SDCC_stm8)\r
+# define _CONCAT(a,b) a##b\r
+# define CONCAT(a,b) _CONCAT(a,b)\r
+# define IRMP_GPIO_STRUCT CONCAT(GPIO, IRMP_PORT_LETTER)\r
+# define IRMP_BIT IRMP_BIT_NUMBER\r
+# define input(x) ((x) & (1 << IRMP_BIT))\r
+\r
+#elif defined (TEENSY_ARM_CORTEX_M4)\r
+# define input(x) ((uint8_t)(digitalReadFast(x)))\r
+\r
+#elif defined(__xtensa__)\r
+# define IRMP_BIT IRMP_BIT_NUMBER\r
+# define input(x) GPIO_INPUT_GET(IRMP_BIT_NUMBER)\r
+#endif\r
+\r
+#if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1\r
+# undef IRMP_SUPPORT_MATSUSHITA_PROTOCOL\r
+# define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1\r
#endif\r
\r
#if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r
# define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r
#endif\r
\r
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 && IRMP_SUPPORT_PANASONIC_PROTOCOL == 1\r
+# warning KASEIKYO protocol conflicts wih PANASONIC, please enable only one of both protocols\r
+# warning PANASONIC protocol disabled\r
+# undef IRMP_SUPPORT_PANASONIC_PROTOCOL\r
+# define IRMP_SUPPORT_PANASONIC_PROTOCOL 0\r
+#endif\r
+\r
+#if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_ACP24_PROTOCOL == 1\r
+# warning DENON protocol conflicts wih ACP24, please enable only one of both protocols\r
+# warning ACP24 protocol disabled\r
+# undef IRMP_SUPPORT_ACP24_PROTOCOL\r
+# define IRMP_SUPPORT_ACP24_PROTOCOL 0\r
+#endif\r
+\r
+#if IRMP_SUPPORT_RC6_PROTOCOL == 1 && IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r
+# warning RC6 protocol conflicts wih ROOMBA, please enable only one of both protocols\r
+# warning ROOMBA protocol disabled\r
+# undef IRMP_SUPPORT_ROOMBA_PROTOCOL\r
+# define IRMP_SUPPORT_ROOMBA_PROTOCOL 0\r
+#endif\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+# warning RC5 protocol conflicts wih ORTEK, please enable only one of both protocols\r
+# warning ORTEK protocol disabled\r
+# undef IRMP_SUPPORT_ORTEK_PROTOCOL\r
+# define IRMP_SUPPORT_ORTEK_PROTOCOL 0\r
+#endif\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_S100_PROTOCOL == 1\r
+# warning RC5 protocol conflicts wih S100, please enable only one of both protocols\r
+# warning S100 protocol disabled\r
+# undef IRMP_SUPPORT_S100_PROTOCOL\r
+# define IRMP_SUPPORT_S100_PROTOCOL 0\r
+#endif\r
+\r
+#if IRMP_SUPPORT_NUBERT_PROTOCOL == 1 && IRMP_SUPPORT_FAN_PROTOCOL == 1\r
+# warning NUBERT protocol conflicts wih FAN, please enable only one of both protocols\r
+# warning FAN protocol disabled\r
+# undef IRMP_SUPPORT_FAN_PROTOCOL\r
+# define IRMP_SUPPORT_FAN_PROTOCOL 0\r
+#endif\r
+\r
+#if IRMP_SUPPORT_FDC_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+# warning FDC protocol conflicts wih ORTEK, please enable only one of both protocols\r
+# warning ORTEK protocol disabled\r
+# undef IRMP_SUPPORT_ORTEK_PROTOCOL\r
+# define IRMP_SUPPORT_ORTEK_PROTOCOL 0\r
+#endif\r
+\r
+#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1 && IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r
+# warning ORTEK protocol conflicts wih NETBOX, please enable only one of both protocols\r
+# warning NETBOX protocol disabled\r
+# undef IRMP_SUPPORT_NETBOX_PROTOCOL\r
+# define IRMP_SUPPORT_NETBOX_PROTOCOL 0\r
+#endif\r
+\r
#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
# warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r
# undef IRMP_SUPPORT_SIEMENS_PROTOCOL\r
# define IRMP_SUPPORT_LEGO_PROTOCOL 0\r
#endif\r
\r
+#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 && IRMP_SUPPORT_SAMSUNG_PROTOCOL == 0\r
+# warning SAMSUNG48 protocol needs also SAMSUNG protocol, SAMSUNG protocol enabled\r
+# undef IRMP_SUPPORT_SAMSUNG_PROTOCOL\r
+# define IRMP_SUPPORT_SAMSUNG_PROTOCOL 1\r
+#endif\r
+\r
#if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
# warning JVC protocol needs also NEC protocol, NEC protocol enabled\r
# undef IRMP_SUPPORT_NEC_PROTOCOL\r
# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
#endif\r
\r
+#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
+# warning LGAIR protocol needs also NEC protocol, NEC protocol enabled\r
+# undef IRMP_SUPPORT_NEC_PROTOCOL\r
+# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
+#endif\r
+\r
+#if IRMP_SUPPORT_RCMM_PROTOCOL == 1 && F_INTERRUPTS < 20000\r
+# warning F_INTERRUPTS too low, RCMM protocol disabled (should be at least 20000)\r
+# undef IRMP_SUPPORT_RCMM_PROTOCOL\r
+# define IRMP_SUPPORT_RCMM_PROTOCOL 0\r
+#endif\r
+\r
#if F_INTERRUPTS > 20000\r
#error F_INTERRUPTS too high (should be not greater than 20000)\r
#endif\r
\r
#define IRMP_FLAG_REPETITION 0x01\r
\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
extern void irmp_init (void);\r
-extern uint8_t irmp_get_data (IRMP_DATA *);\r
-extern uint8_t irmp_is_busy (void);\r
-extern uint8_t irmp_ISR (void);\r
+extern uint_fast8_t irmp_get_data (IRMP_DATA *);\r
+extern uint_fast8_t irmp_ISR (void);\r
\r
#if IRMP_PROTOCOL_NAMES == 1\r
-extern char * irmp_protocol_names[IRMP_N_PROTOCOLS + 1];\r
+extern const char * const irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM;\r
#endif\r
\r
#if IRMP_USE_CALLBACK == 1\r
-extern void irmp_set_callback_ptr (void (*cb)(uint8_t));\r
+extern void irmp_set_callback_ptr (void (*cb)(uint_fast8_t));\r
#endif // IRMP_USE_CALLBACK == 1\r
\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
#endif /* _IRMP_H_ */\r