]> cloudbase.mooo.com Git - irmp.git/blobdiff - irmpsystem.h
Add Macro for timer (timer 3), change IRMP_PORT to PB4 (TIM3_CH1)
[irmp.git] / irmpsystem.h
index d19a0a7656c22488695a439989d638b3596acf23..7300a7617a61329f39d191183e8cb89f5c4bc27f 100644 (file)
@@ -1,9 +1,9 @@
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
  * irmpsystem.h - system specific includes and defines\r
  *\r
- * Copyright (c) 2009-2014 Frank Meyer - frank(at)fli4l.de\r
+ * Copyright (c) 2009-2016 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irmpsystem.h,v 1.14 2014/09/15 10:27:38 fm Exp $\r
+ * $Id: irmpsystem.h,v 1.25 2016/12/19 09:01:41 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
 #  define PIC_C18\r
 #elif defined(__PCM__) || defined(__PCB__) || defined(__PCH__)                      // CCS PIC compiler\r
 #  define PIC_CCS\r
+#elif defined(STM32F1)                                                              // ARM STM32 with libopencm3\r
+#  define ARM_OPENCM3\r
 #elif defined(STM32L1XX_MD) || defined(STM32L1XX_MDP) || defined(STM32L1XX_HD)      // ARM STM32\r
 #  include <stm32l1xx.h>\r
 #  define ARM_STM32\r
 #  define ARM_STM32L1XX\r
+#  define F_CPU (SysCtlClockGet())\r
 #elif defined(STM32F10X_LD) || defined(STM32F10X_LD_VL) \\r
    || defined(STM32F10X_MD) || defined(STM32F10X_MD_VL) \\r
    || defined(STM32F10X_HD) || defined(STM32F10X_HD_VL) \\r
 #  include <stm32f4xx.h>\r
 #  define ARM_STM32\r
 #  define ARM_STM32F4XX\r
-#elif defined(TARGET_IS_BLIZZARD_RA2)                                                                                           // TI Stellaris (tested on Stellaris Launchpad with Code Composer Studio)\r
+#elif defined(__SDCC_stm8)                                                          // STM8\r
+#  define SDCC_STM8\r
+#elif defined(TARGET_IS_BLIZZARD_RA2)                                               // TI Stellaris (tested on Stellaris Launchpad with Code Composer Studio)\r
 #  define STELLARIS_ARM_CORTEX_M4\r
 #  define F_CPU (SysCtlClockGet())\r
+#elif defined(__xtensa__)                                                           // ESP8266 (Arduino)\r
+#  include "Arduino.h"\r
+#  include "ets_sys.h"\r
+#  include "osapi.h"\r
+#  include "gpio.h"\r
+#  include "os_type.h"\r
+#  include "c_types.h"\r
+#  define uint_fast8_t uint8_t\r
+#  define uint_fast16_t uint16_t\r
+#elif defined(TEENSYDUINO) && (defined(__MK20DX256__) || defined(__MK20DX128__))    // Teensy 3.x (tested on Teensy 3.1 in Arduino 1.6.5 / Teensyduino 1.2.5)\r
+#  include <core_pins.h>\r
+#  define TEENSY_ARM_CORTEX_M4\r
 #elif defined(unix) || defined(WIN32) || defined(__APPLE__)                         // Unix/Linux or Windows or Apple\r
 #  define UNIX_OR_WINDOWS\r
+#elif defined(__MBED__)                                                             // mbed platform\r
+// #include "mbed.h"                                                                // if mbed.h is used, source must be compiled as cpp\r
+#include "gpio_api.h"\r
 #else\r
 #  define ATMEL_AVR                                                                 // ATMEL AVR\r
 #endif\r
@@ -80,7 +100,16 @@ typedef unsigned short                  uint16_t;
 #  define IRSND_OC0                     3       // OC0\r
 #  define IRSND_OC0A                    4       // OC0A\r
 #  define IRSND_OC0B                    5       // OC0B\r
+\r
+#  define IRSND_XMEGA_OC0A              0       // OC0A\r
+#  define IRSND_XMEGA_OC0B              1       // OC0B\r
+#  define IRSND_XMEGA_OC0C              2       // OC0C\r
+#  define IRSND_XMEGA_OC0D              3       // OC0D\r
+#  define IRSND_XMEGA_OC1A              4       // OC1A\r
+#  define IRSND_XMEGA_OC1B              5       // OC1B\r
+\r
 #elif defined(STELLARIS_ARM_CORTEX_M4)\r
+\r
 #  include "inc/hw_ints.h"\r
 #  include "inc/hw_memmap.h"\r
 #  include "inc/hw_types.h"\r
@@ -93,24 +122,60 @@ typedef unsigned short                  uint16_t;
 #  include "driverlib/systick.h"\r
 #  include "driverlib/pin_map.h"\r
 #  include "driverlib/timer.h"\r
-#  define PROGMEM volatile\r
-#  define memcpy_P memcpy\r
+#  define PROGMEM\r
+#  define memcpy_P                      memcpy\r
 #  define APP_SYSTICKS_PER_SEC          32\r
+\r
 #elif defined(ARM_STM32F10X)\r
+\r
 #  include "stm32f10x_gpio.h"\r
 #  include "stm32f10x_rcc.h"\r
 #  include "stm32f10x_tim.h"\r
 #  include "misc.h"\r
 #  define PROGMEM\r
 #  define memcpy_P                      memcpy\r
+\r
+#elif defined(ARM_OPENCM3)\r
+\r
+#  include <libopencm3/cm3/nvic.h>\r
+#  include <libopencm3/stm32/rcc.h>\r
+#  include <libopencm3/stm32/gpio.h>\r
+#  include <libopencm3/stm32/timer.h>\r
+#  define PROGMEM\r
+#  define memcpy_P                      memcpy\r
+\r
+#elif defined(SDCC_STM8)\r
+\r
+#  include "stm8s.h"\r
+#  define PROGMEM\r
+#  define memcpy_P                      memcpy\r
+#  define __attribute__(x)\r
+#  define uint_fast8_t                  uint8_t\r
+#  define uint_fast16_t                 uint16_t\r
+\r
+#elif defined(TEENSY_ARM_CORTEX_M4)\r
+#  define PROGMEM\r
+#  define memcpy_P                      memcpy\r
+\r
+#elif defined(__xtensa__)\r
+#  define PROGMEM\r
+#  define memcpy_P                      memcpy\r
+\r
+#elif defined(__MBED__)\r
+#  define PROGMEM\r
+#  define memcpy_P                      memcpy\r
+\r
 #else\r
 #  define PROGMEM\r
 #  define memcpy_P                      memcpy\r
+\r
 #endif\r
 \r
 #if defined(PIC_CCS) || defined(PIC_C18) || defined(ARM_STM32) || defined(STELLARIS_ARM_CORTEX_M4)\r
 typedef unsigned char                   uint8_t;\r
 typedef unsigned short                  uint16_t;\r
+typedef unsigned char                   uint_fast8_t;\r
+typedef unsigned short                  uint_fast16_t;\r
 #endif\r
 \r
 #if defined (PIC_C18)                                                               // PIC C18 or XC8 compiler\r
@@ -128,12 +193,18 @@ typedef unsigned short                  uint16_t;
 #  define FALSE                         0\r
 #endif\r
 \r
-typedef struct\r
+#if defined(PIC_C18)\r
+#define IRMP_PACKED_STRUCT\r
+#else\r
+#define IRMP_PACKED_STRUCT              __attribute__ ((__packed__))\r
+#endif\r
+\r
+typedef struct IRMP_PACKED_STRUCT\r
 {\r
-  uint8_t                               protocol;                                   // protocol, i.e. NEC_PROTOCOL\r
-  uint16_t                              address;                                    // address\r
-  uint16_t                              command;                                    // command\r
-  uint8_t                               flags;                                      // flags, e.g. repetition\r
+    uint8_t                             protocol;                                   // protocol, e.g. NEC_PROTOCOL\r
+    uint16_t                            address;                                    // address\r
+    uint16_t                            command;                                    // command\r
+    uint8_t                             flags;                                      // flags, e.g. repetition\r
 } IRMP_DATA;\r
 \r
 #endif // _IRMPSYSTEM_H_\r