mbed Phone Platform

Dependencies:   ulaw mbed ConfigFile

Revision:
5:30e2847d241b
Parent:
4:41a3534d085f
Child:
6:bd62b12de751
--- a/main.cpp	Fri Jan 07 18:20:41 2011 +0000
+++ b/main.cpp	Thu Jan 20 13:50:10 2011 +0000
@@ -25,9 +25,6 @@
 Line line2(p14, p15, p16, dac);
 IpLine ipline(dac, adc);
 
-DigitalOut led_y(p25), led_g(p26);
-DigitalIn eth_link(P1_25), eth_speed(P1_26);
-
 volatile int timeout;
 int dialcount;
 char dial[DIAL_SIZE];
@@ -37,9 +34,9 @@
     {{1, 10, 1}, PhoneLine1, ""},
     {{1, 10, 2}, PhoneLine2, ""},
     {{1, 10, 3}, PhoneMicSp, ""},
-    {{2, 10, 1}, PhoneLine1, "192.168.0.2"},
-    {{2, 10, 2}, PhoneLine2, "192.168.0.2"},
-    {{2, 10, 3}, PhoneMicSp, "192.168.0.2"}
+    {{2, 10, 1}, PhoneLine1, "192.168.1.2"},
+    {{2, 10, 2}, PhoneLine2, "192.168.1.2"},
+    {{2, 10, 3}, PhoneMicSp, "192.168.1.2"}
 /*
     {{2, 10, 1}, PhoneLine1, "192.168.10.100"},
     {{2, 10, 2}, PhoneLine2, "192.168.10.100"},
@@ -81,7 +78,7 @@
     mixline = 0;
 
     wait_ms(1);
-    dac = 0x7fff;
+    dac.write_u16(0x7fff);
 
     switch (target) {
     case PhoneLine1:
@@ -267,13 +264,19 @@
     line2.enter(ModeReady);
     ipline.enter(ModeReady);
 
-    NVIC_SetPriority(TIMER3_IRQn, (1 << __NVIC_PRIO_BITS) - 1); // preemption=1, sub-priority=1
+//    NVIC_SetPriority(TIMER3_IRQn, 0); // preemption=1, sub-priority=1
     ticker.attach_us(&int_sample, 1000000 / FREQ);
 
     for (;;) {
+        led1 = 1;
         ipline.poll();
+        led1 = 0;
+        led2 = 1;
         line1.poll();
+        led2 = 0;
+        led3 = 1;
         line2.poll();
+        led3 = 0;
 
         i = scanline(PhoneLine1, ScanMode);
         checkline(PhoneLine1);
@@ -289,26 +292,6 @@
         checkline(PhoneIpLine);
         if (i != scanline(PhoneIpLine, ScanMode))
             pc.printf("(3) %d -> %d\r\n", i, scanline(PhoneIpLine, ScanMode));
-
-        // debug        
-        if(pc.readable()) {
-            if (pc.getc() == 'a') {
-              char buf[30];
-              enum PhoneType p;
-              dial[0] = 2;
-              dial[1] = 10;
-              dial[2] = 1;
-              dialcount = 3;
-              if (getpb(&p, buf)) {
-                if (buf[0] != 0) {
-                    activedest = PhoneIpLine;
-                    ipline.settarget(p, buf);
-                    enterline(PhoneLine1, ModeCall);
-                    enterline(activedest, ModeRing);
-                }
-              }
-            }
-        }
         
     }
 }