]> cloudbase.mooo.com Git - irmp.git/blobdiff - irmp.c
Version 2.9.6: added support for STM8 mikrocontroller
[irmp.git] / irmp.c
diff --git a/irmp.c b/irmp.c
index 8bf45dc90b1df4e334663a9ab0cb579f11356e62..3ad194813369929d2af576e37474e93a328d9313 100644 (file)
--- a/irmp.c
+++ b/irmp.c
@@ -3,7 +3,7 @@
  *\r
  * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irmp.c,v 1.177 2015/09/19 15:28:31 fm Exp $\r
+ * $Id: irmp.c,v 1.178 2015/11/10 08:39:27 fm Exp $\r
  *\r
  * Supported AVR mikrocontrollers:\r
  *\r
@@ -2013,6 +2013,9 @@ irmp_init (void)
      ROM_GPIOPadConfigSet(IRMP_PORT_BASE, IRMP_PORT_PIN,\r
                           GPIO_STRENGTH_2MA,\r
                           GPIO_PIN_TYPE_STD_WPU);\r
+#elif defined(__SDCC_stm8)                                              // STM8\r
+    IRMP_GPIO_STRUCT->CR1 |= (1<<IRMP_BIT);                             // activate pullup\r
+    IRMP_GPIO_STRUCT->DDR &= ~(1<<IRMP_BIT);                            // pin is input\r
 #else                                                                   // AVR\r
     IRMP_PORT &= ~(1<<IRMP_BIT);                                        // deactivate pullup\r
     IRMP_DDR &= ~(1<<IRMP_BIT);                                         // set pin to input\r
@@ -2521,7 +2524,11 @@ irmp_ISR (void)
     time_counter++;\r
 #endif // ANALYZE\r
 \r
+#if defined(__SDCC_stm8)\r
+    irmp_input = input(IRMP_GPIO_STRUCT->IDR)\r
+#else\r
     irmp_input = input(IRMP_PIN);\r
+#endif\r
 \r
 #if IRMP_USE_CALLBACK == 1\r
     if (irmp_callback_ptr)\r
@@ -3594,7 +3601,7 @@ irmp_ISR (void)
                             else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN)\r
                             {\r
 #ifdef ANALYZE\r
-                                ANALYZE_PRINTF ("Switching to NOKIA protocol\n");\r
+                                ANALYZE_PRINTF ("Switching to NOKIA protocol, irmp_bit = %d\n", irmp_bit);\r
 #endif // ANALYZE\r
                                 irmp_param.protocol         = IRMP_NOKIA_PROTOCOL;      // change protocol\r
                                 irmp_param.address_offset   = NOKIA_ADDRESS_OFFSET;\r