]> cloudbase.mooo.com Git - irmp.git/blobdiff - irmp-main-esp8266.c
Version 3.0.7 - added SAMSUNGAH protocol, improved some code for ESP8266
[irmp.git] / irmp-main-esp8266.c
index 65124cb28b90ebfefec18f67cf851a212d751498..b8c644567713456ffc600335490e993a1e3ce397 100644 (file)
@@ -2,13 +2,15 @@
 \r
 Test program IRMP for ESP8266                2015-11-16 Wolfgang Strobl, Bonn\r
 \r
+$Id: irmp-main-esp8266.c,v 1.4 2017/02/17 09:13:06 fm Exp $\r
+\r
 IRMP ported to ESP8266, testet with MOD-WIFI-ESP8266-DEV on\r
 ESP8266-EVB evaluation board. https://www.olimex.com/Products/IoT/ESP8266-EVB/\r
 \r
 Connections\r
 -----------\r
 \r
-Input TSOP via 1k resistor at GPIO12 (Pin 7 UEXT), \r
+Input TSOP via 1k resistor at GPIO12 (Pin 7 UEXT),\r
 Output via UART (Pin 3/4 UEXT)\r
 \r
 example output\r
@@ -104,7 +106,7 @@ static void user_procTask(os_event_t *events);
 // unbuffered Uart-rx, based on a comment in\r
 // https://github.com/SuperHouse/esp-open-rtos/issues/18\r
 \r
-int my_rx_one_char(void)  // char or -1 \r
+int my_rx_one_char(void)  // char or -1\r
 {\r
     int c = READ_PERI_REG(UART_STATUS(0)) & 0xff;\r
     if (c) return READ_PERI_REG(UART_FIFO(0));\r
@@ -116,11 +118,11 @@ IRMP_DATA irmp_data;
 \r
 //------------------ User Task ---------------------\r
 \r
-static void \r
+static void\r
 user_procTask(os_event_t *events)\r
 {\r
-    int rc = irmp_get_data (&irmp_data);   \r
-      \r
+    int rc = irmp_get_data (&irmp_data);\r
+\r
     if (rc)\r
     {\r
         os_printf("\nIRMP %10s(%2d): addr=0x%04x cmd=0x%04x, f=%d ",\r
@@ -131,13 +133,13 @@ user_procTask(os_event_t *events)
             irmp_data.flags\r
         );\r
     }\r
-    \r
+\r
     // https://github.com/SuperHouse/esp-open-rtos/issues/18\r
     // uart_rx_one_char ist offenbar eine ROM-Funktion.\r
-    \r
+\r
     int c = my_rx_one_char();\r
-    \r
-    if(c != -1) \r
+\r
+    if(c != -1)\r
     {\r
         uart_tx_one_char(0,c);\r
         os_printf("(0x%02x, %d) ",c,c);\r
@@ -149,43 +151,42 @@ user_procTask(os_event_t *events)
                 os_printf("gpio=%08x ",gpio_input_get());\r
                 break;\r
         }\r
-    }    \r
+    }\r
     os_delay_us(100);\r
-    system_os_post(user_procTaskPrio, 0, 0 );    \r
+    system_os_post(user_procTaskPrio, 0, 0 );\r
 }\r
 \r
-// Init function \r
+// Init function\r
 \r
 void ICACHE_FLASH_ATTR\r
 user_init()\r
 {\r
     void* p;\r
     uint32 now,diff;\r
-    \r
+\r
     //~ system_timer_reinit(); //US_TIMER\r
-    \r
-    uart_init(BIT_RATE_115200, BIT_RATE_115200);    \r
+\r
+    uart_init(BIT_RATE_115200, BIT_RATE_115200);\r
     os_printf("\n\nESP8266 IRMP Test v0.3 W.Strobl 20151120\n");\r
 \r
     os_printf("F_INTERRUPTS==%d\n",F_INTERRUPTS);\r
-    \r
+\r
     sysinfo();\r
-    \r
+\r
     hw_timer_init(NMI_SOURCE,1);\r
     hw_timer_set_func(irmp_timer);\r
     hw_timer_arm (1000000/F_INTERRUPTS);\r
-    \r
+\r
     // Initialize the GPIO subsystem.\r
     gpio_init();\r
-    \r
-    \r
+\r
+\r
     irmp_init ();\r
-    \r
+\r
     //Start os task\r
-    \r
+\r
     system_os_task(user_procTask, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);\r
     system_os_post(user_procTaskPrio, 0, 0 );\r
-    \r
+\r
     os_printf("IRMP listening ...\n");\r
-        \r
 }\r