Multi IoT BoardのIRテストプログラム

Dependencies:   mbed TextLCD RemoteIR

Fork of RemoteIR_TestProgram by Shinichiro Nakamura

Revision:
6:d1233e2387f9
Parent:
5:40750d5779ca
diff -r 40750d5779ca -r d1233e2387f9 main.cpp
--- a/main.cpp	Wed Oct 13 10:51:41 2010 +0000
+++ b/main.cpp	Tue Sep 20 11:48:53 2016 +0000
@@ -9,15 +9,12 @@
 
 #include "ReceiverIR.h"
 #include "TransmitterIR.h"
-#include "TextLCD.h"
 
 #define TEST_LOOP_BACK  0
 
-ReceiverIR ir_rx(p15);
-TransmitterIR ir_tx(p21);
-TextLCD lcd(p24, p26, p27, p28, p29, p30);
-BusOut led(LED4, LED3, LED2, LED1);
-Ticker ledTicker;
+ReceiverIR ir_rx(PA_2);
+TransmitterIR ir_tx(PF_0);
+Serial pc(USBTX,USBRX);
 
 /**
  * Receive.
@@ -63,33 +60,32 @@
  * Display a current status.
  */
 void display_status(char *status, int bitlength) {
-    lcd.locate(8, 0);
-    lcd.printf("%-5.5s:%02d", status, bitlength);
+    pc.printf("%-5.5s:%02d\r\n", status, bitlength);
 }
 
 /**
  * Display a format of a data.
  */
 void display_format(RemoteIR::Format format) {
-    lcd.locate(0, 0);
+
     switch (format) {
         case RemoteIR::UNKNOWN:
-            lcd.printf("????????");
+            pc.printf("????????\r\n");
             break;
         case RemoteIR::NEC:
-            lcd.printf("NEC     ");
+            pc.printf("NEC     \r\n");
             break;
         case RemoteIR::NEC_REPEAT:
-            lcd.printf("NEC  (R)");
+            pc.printf("NEC  (R)\r\n");
             break;
         case RemoteIR::AEHA:
-            lcd.printf("AEHA    ");
+            pc.printf("AEHA    \r\n");
             break;
         case RemoteIR::AEHA_REPEAT:
-            lcd.printf("AEHA (R)");
+            pc.printf("AEHA (R)\r\n");
             break;
         case RemoteIR::SONY:
-            lcd.printf("SONY    ");
+            pc.printf("SONY    \r\n");
             break;
     }
 }
@@ -101,46 +97,34 @@
  * @param bitlength Bit length of a data.
  */
 void display_data(uint8_t *buf, int bitlength) {
-    lcd.locate(0, 1);
     const int n = bitlength / 8 + (((bitlength % 8) != 0) ? 1 : 0);
     for (int i = 0; i < n; i++) {
-        lcd.printf("%02X", buf[i]);
+        pc.printf("%02X", buf[i]);
     }
     for (int i = 0; i < 8 - n; i++) {
-        lcd.printf("--");
+        pc.printf("--");
     }
 }
 
-void ledfunc(void) {
-    led = led + 1;
-}
-
 /**
  * Entry point.
  */
 int main(void) {
 
-    ledTicker.attach(&ledfunc, 0.5);
 
     /*
      * Splash.
      */
-    lcd.cls();
-    lcd.locate(0, 0);
-    lcd.printf("RemoteIR        ");
-    lcd.locate(0, 1);
-    lcd.printf("Program example.");
+    pc.printf("RemoteIR        \r\n");
+    pc.printf("Program example.\r\n");
     wait(3);
 
     /*
      * Initialize.
      */
-    led = 0;
-    lcd.cls();
-    lcd.locate(0, 0);
-    lcd.printf("Press a button  ");
-    lcd.locate(0, 1);
-    lcd.printf("on a controller.");
+
+    pc.printf("Press a button  \r\n");
+    pc.printf("on a controller.\r\n");
 
     /*
      * Execute.