From d27129351c1ef45bf0dbaab401d377b2b61e5edf Mon Sep 17 00:00:00 2001 From: Christian Taedcke Date: Thu, 19 Jun 2014 18:14:29 +0200 Subject: [PATCH] [LPC1549] Fix pin assignment for simple io tests. --- .../tests/mbed/digitalin_digitalout/main.cpp | 6 ++++ libraries/tests/mbed/digitalinout/main.cpp | 34 ++++++++++++++++--- libraries/tests/mbed/interruptin/main.cpp | 6 ++++ workspace_tools/tests.py | 1 + 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/libraries/tests/mbed/digitalin_digitalout/main.cpp b/libraries/tests/mbed/digitalin_digitalout/main.cpp index 15848c320f..67e0d00226 100644 --- a/libraries/tests/mbed/digitalin_digitalout/main.cpp +++ b/libraries/tests/mbed/digitalin_digitalout/main.cpp @@ -4,6 +4,12 @@ DigitalOut out(dp1); DigitalIn in(dp2); +#elif defined(TARGET_LPC1549) +// TARGET_FF_ARDUINO cannot be used, because D0 is used as USBRX (USB serial +// port pin), D1 is used as USBTX +DigitalOut out(D7); +DigitalIn in(D2); + #elif defined(TARGET_NUCLEO_F103RB) DigitalOut out(PC_6); DigitalIn in(PB_8); diff --git a/libraries/tests/mbed/digitalinout/main.cpp b/libraries/tests/mbed/digitalinout/main.cpp index 2ba498e4ef..6744c00229 100644 --- a/libraries/tests/mbed/digitalinout/main.cpp +++ b/libraries/tests/mbed/digitalinout/main.cpp @@ -4,6 +4,12 @@ DigitalInOut d1(dp1); DigitalInOut d2(dp2); +#elif defined(TARGET_LPC1549) +// TARGET_FF_ARDUINO cannot be used, because D0 is used as USBRX (USB serial +// port pin), D1 is used as USBTX +DigitalInOut d1(D2); +DigitalInOut d2(D7); + #elif defined(TARGET_NUCLEO_F103RB) DigitalInOut d1(PC_6); DigitalInOut d2(PB_8); @@ -25,13 +31,33 @@ int main() { d1.output(); d2.input(); - d1 = 1; wait(0.1); if (d2 != 1) check = false; - d1 = 0; wait(0.1); if (d2 != 0) check = false; + d1 = 1; + wait(0.1); + if (d2 != 1) { + printf("First check failed! d2 is %d\n", (int) d2); + check = false; + } + d1 = 0; + wait(0.1); + if (d2 != 0) { + printf("Second check failed! d2 is %d\n", (int) d2); + check = false; + } d1.input(); d2.output(); - d2 = 1; wait(0.1); if (d1 != 1) check = false; - d2 = 0; wait(0.1); if (d1 != 0) check = false; + d2 = 1; + wait(0.1); + if (d1 != 1) { + printf("Third check failed! d1 is %d\n", (int) d1); + check = false; + } + d2 = 0; + wait(0.1); + if (d1 != 0) { + printf("Fourth check failed! d1 is %d\n", (int) d1); + check = false; + } notify_completion(check); } diff --git a/libraries/tests/mbed/interruptin/main.cpp b/libraries/tests/mbed/interruptin/main.cpp index 9ac370c2f3..e35e4ec552 100644 --- a/libraries/tests/mbed/interruptin/main.cpp +++ b/libraries/tests/mbed/interruptin/main.cpp @@ -25,6 +25,12 @@ void in_handler() { #define PIN_OUT dp1 #define PIN_IN dp2 +#elif defined(TARGET_LPC1549) +// TARGET_FF_ARDUINO cannot be used, because D0 is used as USBRX (USB serial +// port pin), D1 is used as USBTX +#define PIN_OUT D2 +#define PIN_IN D7 + #elif defined(TARGET_LPC4088) #define PIN_IN (p11) #define PIN_OUT (p12) diff --git a/workspace_tools/tests.py b/workspace_tools/tests.py index acc796897d..1b0f00ea82 100644 --- a/workspace_tools/tests.py +++ b/workspace_tools/tests.py @@ -42,6 +42,7 @@ Wiring: * digital_loop (Digital(In|Out|InOut), InterruptIn): * Arduino headers: (D0 <-> D7) + * LPC1549: (D2 <-> D7) * LPC1*: (p5 <-> p25 ) * KL25Z: (PTA5<-> PTC6) * NUCLEO_F103RB: (PC_6 <-> PB_8)