diff options
-rw-r--r-- | irmp.c | 9 | ||||
-rw-r--r-- | irmp.h | 11 | ||||
-rw-r--r-- | irmpconfig.h | 8 | ||||
-rw-r--r-- | irmpsystem.h | 12 |
4 files changed, 40 insertions, 0 deletions
@@ -2189,6 +2189,15 @@ irmp_init (void) # endif
GPIO_Init(IRMP_PORT, &GPIO_InitStructure);
+#elif defined (ARM_OPENCM3) // STM32 with libopencm3
+
+ /* GPIOx clock enable */
+ rcc_periph_clock_enable(IRMP_PORT_RCC);
+
+ /* GPIO Configuration */
+ gpio_set_mode(IRMP_PORT, GPIO_MODE_INPUT,
+ GPIO_CNF_INPUT_FLOAT, 1<<IRMP_BIT);
+
#elif defined(STELLARIS_ARM_CORTEX_M4)
// Enable the GPIO port
ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH);
@@ -63,6 +63,17 @@ # warning The STM32 port of IRMP uses the ST standard peripheral drivers which are not enabled in your build configuration.
# endif
+#elif defined (ARM_OPENCM3)
+# define _CONCAT(a,b) a##b
+# define CONCAT(a,b) _CONCAT(a,b)
+# define IRMP_PORT CONCAT(GPIO, IRMP_PORT_LETTER)
+# define IRMP_PORT_RCC CONCAT(RCC_GPIO, IRMP_PORT_LETTER)
+
+# define IRMP_BIT IRMP_BIT_NUMBER
+# define IRMP_PIN IRMP_PORT // for use with input(x) below
+# define input(x) ((GPIO_IDR(IRMP_PORT) & (1<<IRMP_BIT)) != 0)
+//# define input(x) (BBIO_PERIPH(IRMP_PORT+IDR, IRMP_BIT))
+
#elif defined (STELLARIS_ARM_CORTEX_M4)
# define _CONCAT(a,b) a##b
# define CONCAT(a,b) _CONCAT(a,b)
diff --git a/irmpconfig.h b/irmpconfig.h index 245129f..75d9834 100644 --- a/irmpconfig.h +++ b/irmpconfig.h @@ -137,6 +137,14 @@ # define IRMP_BIT_NUMBER 13
/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * Change hardware pin here for ARM STM32 with libopencm3
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+#elif defined (ARM_OPENCM3) // use C13 as IR input on STM32
+# define IRMP_PORT_LETTER C
+# define IRMP_BIT_NUMBER 13
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
* Change hardware pin here for Stellaris ARM Cortex M4
*---------------------------------------------------------------------------------------------------------------------------------------------------
*/
diff --git a/irmpsystem.h b/irmpsystem.h index 25bacb2..e1fbc97 100644 --- a/irmpsystem.h +++ b/irmpsystem.h @@ -26,6 +26,9 @@ # define PIC_C18
#elif defined(__PCM__) || defined(__PCB__) || defined(__PCH__) // CCS PIC compiler
# define PIC_CCS
+#elif defined(STM32F1) // ARM STM32 with libopencm3
+# define ARM_OPENCM3
+# define F_CPU (SysCtlClockGet())
#elif defined(STM32L1XX_MD) || defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) // ARM STM32
# include <stm32l1xx.h>
# define ARM_STM32
@@ -133,6 +136,15 @@ typedef unsigned short uint16_t; # define PROGMEM
# define memcpy_P memcpy
+#elif defined(ARM_OPENCM3)
+
+# include <libopencm3/cm3/nvic.h>
+# include <libopencm3/stm32/rcc.h>
+# include <libopencm3/stm32/gpio.h>
+# include <libopencm3/stm32/timer.h>
+# define PROGMEM
+# define memcpy_P memcpy
+
#elif defined(SDCC_STM8)
# include "stm8s.h"
|