diff --git a/libraries/tests/mbed/analog/main.cpp b/libraries/tests/mbed/analog/main.cpp index b35095c573..8d5316bbe7 100644 --- a/libraries/tests/mbed/analog/main.cpp +++ b/libraries/tests/mbed/analog/main.cpp @@ -1,3 +1,11 @@ +#if !DEVICE_ANALOGIN + #error [NOT_SUPPORTED] AnalogIn not supported +#endif + +#if !DEVICE_ANALOGOUT + #error [NOT_SUPPORTED] AnalogOut not supported +#endif + #include "test_env.h" #if defined(TARGET_K64F) | defined (TARGET_K22F) diff --git a/libraries/tests/mbed/analog_pot/main.cpp b/libraries/tests/mbed/analog_pot/main.cpp index 2f64bcbb6e..2b141cd45e 100644 --- a/libraries/tests/mbed/analog_pot/main.cpp +++ b/libraries/tests/mbed/analog_pot/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_ANALOGIN + #error [NOT_SUPPORTED] AnalogIn not supported +#endif + #include "mbed.h" #include "test_env.h" @@ -15,11 +19,11 @@ int main(void) { bool result = false; float val1, val2; - + for (int i = 0; i < TEST_ITERATIONS; i++) { val1 = pot1.read(); val2 = pot2.read(); - + const char *succes_str = val1 > MEASURE_MIN || val2 > MEASURE_MIN ? "[OK]" : "[FAIL]"; result = result || (val1 > MEASURE_MIN || val2 > MEASURE_MIN); printf("Pot values %f, %f\r\n", val1, val2); diff --git a/libraries/tests/mbed/bus/main.cpp b/libraries/tests/mbed/bus/main.cpp index 0faa0990a9..b10669e856 100644 --- a/libraries/tests/mbed/bus/main.cpp +++ b/libraries/tests/mbed/bus/main.cpp @@ -13,23 +13,26 @@ BusOut bus2(PB03, PB22, PB02, PB23); BusOut bus1(PA02, PA03, PA04, PA05, PA06, PA07, PA08, PA09, PA10, PA11, PA16, PA17); BusOut bus2(PB10, PB11, PB12, PB13); -#else +#elif defined(TARGET_FF_ARDUINO) BusOut bus1(D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15); BusOut bus2(A5, A4, A3, A2, A1, A0); +#else +#error [NOT_SUPPORTED] This test is not supported on this target + #endif int i; - + int main() { notify_start(); - + for (i=0; i<=65535; i++) { bus1 = i; bus2 = i; wait(0.0001); } - + notify_completion(true); } \ No newline at end of file diff --git a/libraries/tests/mbed/can/main.cpp b/libraries/tests/mbed/can/main.cpp index 56ebc1f694..2fd716d106 100644 --- a/libraries/tests/mbed/can/main.cpp +++ b/libraries/tests/mbed/can/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_CAN + #error [NOT_SUPPORTED] CAN not supported +#endif + #include "mbed.h" Ticker ticker; diff --git a/libraries/tests/mbed/can_interrupt/main.cpp b/libraries/tests/mbed/can_interrupt/main.cpp index 17d129a46b..7356bece14 100644 --- a/libraries/tests/mbed/can_interrupt/main.cpp +++ b/libraries/tests/mbed/can_interrupt/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_CAN + #error [NOT_SUPPORTED] CAN not supported +#endif + #include "mbed.h" Ticker ticker; diff --git a/libraries/tests/mbed/can_loopback/main.cpp b/libraries/tests/mbed/can_loopback/main.cpp index cf786597c9..90664ec57b 100644 --- a/libraries/tests/mbed/can_loopback/main.cpp +++ b/libraries/tests/mbed/can_loopback/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_CAN + #error [NOT_SUPPORTED] CAN not supported +#endif + #include "mbed.h" #include "test_env.h" diff --git a/libraries/tests/mbed/dir/main.cpp b/libraries/tests/mbed/dir/main.cpp index feb3241057..500de36e9f 100644 --- a/libraries/tests/mbed/dir/main.cpp +++ b/libraries/tests/mbed/dir/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_LOCALFILESYSTEM + #error [NOT_SUPPORTED] LocalFileSystem not supported +#endif + #include "mbed.h" void led_blink(PinName led) { diff --git a/libraries/tests/mbed/freopen/main.cpp b/libraries/tests/mbed/freopen/main.cpp index 145a684a7e..3436b54482 100644 --- a/libraries/tests/mbed/freopen/main.cpp +++ b/libraries/tests/mbed/freopen/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_LOCALFILESYSTEM + #error [NOT_SUPPORTED] LocalFileSystem not supported +#endif + #include "mbed.h" #include "TextLCD.h" diff --git a/libraries/tests/mbed/i2c_master/main.cpp b/libraries/tests/mbed/i2c_master/main.cpp index baac46e66c..67f23acb2c 100644 --- a/libraries/tests/mbed/i2c_master/main.cpp +++ b/libraries/tests/mbed/i2c_master/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_I2C + #error [NOT_SUPPORTED] I2C is not supported +#endif + #include "mbed.h" #include "test_env.h" diff --git a/libraries/tests/mbed/i2c_slave/main.cpp b/libraries/tests/mbed/i2c_slave/main.cpp index 5553a28975..7b168b7dde 100644 --- a/libraries/tests/mbed/i2c_slave/main.cpp +++ b/libraries/tests/mbed/i2c_slave/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_I2CSLAVE + #error [NOT_SUPPORTED] I2C Slave is not supported +#endif + #include "mbed.h" #include "test_env.h" diff --git a/libraries/tests/mbed/interrupt_chaining/main.cpp b/libraries/tests/mbed/interrupt_chaining/main.cpp index ef5d848836..8a41b9527a 100644 --- a/libraries/tests/mbed/interrupt_chaining/main.cpp +++ b/libraries/tests/mbed/interrupt_chaining/main.cpp @@ -16,7 +16,7 @@ #elif defined(TARGET_SAML21J18A) #define TIMER_IRQ TC0_IRQn #else -#error This test can't run on this target. +#error [NOT_SUPPORTED] This test can't run on this target. #endif Serial pc(USBTX, USBRX); diff --git a/libraries/tests/mbed/portout/main.cpp b/libraries/tests/mbed/portout/main.cpp index 3b106c98d6..dbf1f78d23 100644 --- a/libraries/tests/mbed/portout/main.cpp +++ b/libraries/tests/mbed/portout/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_PORTOUT + #error [NOT_SUPPORTED] PortOut is not supported +#endif + #include "mbed.h" # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC2460) @@ -27,8 +31,8 @@ # elif defined(TARGET_SAMR21G18A) # define LED_PORT PortA # define LED1 (1 << 19) /*PA19*/ -# define LED2 0 -# define LED3 0 +# define LED2 0 +# define LED3 0 # define LED4 0 # elif defined(TARGET_SAMD21J18A) # define LED_PORT PortB @@ -48,7 +52,9 @@ # define LED2 0 # define LED3 0 # define LED4 0 -# endif +# else + #error [NOT_SUPPORTED] This test can't be ran on this target +#endif #define LED_MASK (LED1|LED2|LED3|LED4) diff --git a/libraries/tests/mbed/pwm/main.cpp b/libraries/tests/mbed/pwm/main.cpp index 2e5754f790..ebfa0ca57a 100644 --- a/libraries/tests/mbed/pwm/main.cpp +++ b/libraries/tests/mbed/pwm/main.cpp @@ -48,7 +48,7 @@ int main() { printf("Initialize PWM on pin 24 with duty cycle: %.2f\n", pwm_dp24.read()); printf("Initialize PWM on pin 18 with duty cycle: %.2f\n", pwm_dp18.read()); -#elif defined(TARGET_nRF51822) +#elif defined(TARGET_NRF51822) PwmOut pwm_p24(p24); PwmOut pwm_p25(p25); @@ -100,7 +100,7 @@ int main() { pwm_1.write(value); pwm_2.write(0.50); - + float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result); @@ -111,7 +111,7 @@ int main() { PwmOut pwm_1(PA_0); pwm_1.write(value); - + float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result); @@ -121,7 +121,7 @@ int main() { PwmOut pwm_1(PA_0); pwm_1.write(value); - + float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result); @@ -131,7 +131,7 @@ int main() { PwmOut pwm_1(PA_0); pwm_1.write(value); - + float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result); @@ -141,7 +141,7 @@ int main() { PwmOut pwm_1(PA_0); pwm_1.write(value); - + float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result); @@ -151,7 +151,7 @@ int main() { PwmOut pwm_1(PA_0); pwm_1.write(value); - + float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result); @@ -177,7 +177,7 @@ int main() { notify_completion(result == value ? true : false); #else -#error This test is not supported on this target. +#error [NOT_SUPPORTED] This test is not supported on this target. #endif notify_completion(true); diff --git a/libraries/tests/mbed/pwm_led/pwm.cpp b/libraries/tests/mbed/pwm_led/pwm.cpp index 5739bf57b6..4ef9da3e32 100644 --- a/libraries/tests/mbed/pwm_led/pwm.cpp +++ b/libraries/tests/mbed/pwm_led/pwm.cpp @@ -26,14 +26,14 @@ #elif defined (TARGET_MAXWSNENV) #define TEST_LED LED_GREEN -#elif defined (TARGET_DISCO_F407VG) +#elif defined (TARGET_DISCO_F407VG) #define TEST_LED LED1 #elif defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A) || defined(TARGET_SAMD21G18A) || defined(TARGET_SAML21J18A) #define TEST_LED LED1 #else -#error This test is not supported on this target. + #error [NOT_SUPPORTED] This test is not supported on this target #endif PwmOut led(TEST_LED); diff --git a/libraries/tests/mbed/reset/main.cpp b/libraries/tests/mbed/reset/main.cpp index b38218e706..36a643e31d 100644 --- a/libraries/tests/mbed/reset/main.cpp +++ b/libraries/tests/mbed/reset/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_SEMIHOST + #error [NOT_SUPPORTED] Semihost not supported +#endif + #include "mbed.h" Serial pc(USBTX, USBRX); diff --git a/libraries/tests/mbed/spi/main.cpp b/libraries/tests/mbed/spi/main.cpp index ceef120f01..cee94e5a92 100644 --- a/libraries/tests/mbed/spi/main.cpp +++ b/libraries/tests/mbed/spi/main.cpp @@ -1,5 +1,9 @@ #include "mbed.h" +#if !DEVICE_SPI + #error [NOT_SUPPORTED] SPI is not supported +#endif + #if defined(TARGET_SAMR21G18A) SPI spi(PB22, PB02, PB23); // mosi, miso, sclk DigitalOut latchpin(PB03); diff --git a/libraries/tests/mbed/spi_master/main.cpp b/libraries/tests/mbed/spi_master/main.cpp index 835c4af5d8..821cbd2f9a 100644 --- a/libraries/tests/mbed/spi_master/main.cpp +++ b/libraries/tests/mbed/spi_master/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_SPI + #error [NOT_SUPPORTED] SPI not supported +#endif + #include "mbed.h" #include "test_env.h" diff --git a/libraries/tests/mbed/spi_slave/main.cpp b/libraries/tests/mbed/spi_slave/main.cpp index 22830d2cf3..b676e29020 100644 --- a/libraries/tests/mbed/spi_slave/main.cpp +++ b/libraries/tests/mbed/spi_slave/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_SPISLAVE + #error [NOT_SUPPORTED] SPI Slave not supported +#endif + #include "mbed.h" #if defined(TARGET_KL25Z) diff --git a/libraries/tests/mbed/stdio_benchmark/main.cpp b/libraries/tests/mbed/stdio_benchmark/main.cpp index b9179815dc..4d4eaef31b 100644 --- a/libraries/tests/mbed/stdio_benchmark/main.cpp +++ b/libraries/tests/mbed/stdio_benchmark/main.cpp @@ -1,3 +1,7 @@ +#if !DEVICE_LOCALFILESYSTEM + #error [NOT_SUPPORTED] LocalFileSystem not supported +#endif + #include "mbed.h" #define TEST_STDIO 0