This is sample program for Nucleo L152RE (and F401RE & F411RE) mbed-rtos. You need to modify mbed-src and mbed-rtos before compile it.

Dependencies:   mbed-rtos mbed-src SetRTC

Fork of GR-PEACH_test_on_rtos_works_well by Kenji Arai

Please refer below link.
/users/kenjiArai/notebook/necleo-l152re-rtos-sample-also-for-f401re--f411re-/

Committer:
kenjiArai
Date:
Sat Nov 29 12:29:49 2014 +0000
Revision:
0:a17b3cf2f466
Child:
1:a399a743d109
GR-PEACH test program / (a) LED = 1 -> OFF (not standard mbed way), (b) printf is not synchronized

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kenjiArai 0:a17b3cf2f466 1 #include "mbed.h"
kenjiArai 0:a17b3cf2f466 2
kenjiArai 0:a17b3cf2f466 3 //#define PIN_NUM
kenjiArai 0:a17b3cf2f466 4 #define LED_NAME
kenjiArai 0:a17b3cf2f466 5 //#define LED_COLOR
kenjiArai 0:a17b3cf2f466 6
kenjiArai 0:a17b3cf2f466 7 #if defined(PIN_NUM)
kenjiArai 0:a17b3cf2f466 8 DigitalOut myledR(P4_4);
kenjiArai 0:a17b3cf2f466 9 DigitalOut myledG(P3_2);
kenjiArai 0:a17b3cf2f466 10 DigitalOut myledB(P4_6);
kenjiArai 0:a17b3cf2f466 11 DigitalOut myledU(P4_7);
kenjiArai 0:a17b3cf2f466 12 #elif defined(LED_NAME)
kenjiArai 0:a17b3cf2f466 13 DigitalOut myledR(LED1);
kenjiArai 0:a17b3cf2f466 14 DigitalOut myledG(LED2);
kenjiArai 0:a17b3cf2f466 15 DigitalOut myledB(LED3);
kenjiArai 0:a17b3cf2f466 16 DigitalOut myledU(LED4);
kenjiArai 0:a17b3cf2f466 17 #elif defined(LED_COLOR)
kenjiArai 0:a17b3cf2f466 18 DigitalOut myledR(LED_RED);
kenjiArai 0:a17b3cf2f466 19 DigitalOut myledG(LED_GREEN);
kenjiArai 0:a17b3cf2f466 20 DigitalOut myledB(LED_BLUE);
kenjiArai 0:a17b3cf2f466 21 DigitalOut myledU(LED_USER);
kenjiArai 0:a17b3cf2f466 22 #endif
kenjiArai 0:a17b3cf2f466 23
kenjiArai 0:a17b3cf2f466 24 #define ON 0
kenjiArai 0:a17b3cf2f466 25 #define OFF 1
kenjiArai 0:a17b3cf2f466 26
kenjiArai 0:a17b3cf2f466 27 int main() {
kenjiArai 0:a17b3cf2f466 28 uint32_t n = 0;
kenjiArai 0:a17b3cf2f466 29
kenjiArai 0:a17b3cf2f466 30 printf("Start mbed program\r\n");
kenjiArai 0:a17b3cf2f466 31 myledR = OFF;
kenjiArai 0:a17b3cf2f466 32 printf("RF,");
kenjiArai 0:a17b3cf2f466 33 myledG = OFF;
kenjiArai 0:a17b3cf2f466 34 printf("GF,");
kenjiArai 0:a17b3cf2f466 35 myledB = OFF;
kenjiArai 0:a17b3cf2f466 36 printf("BF,");
kenjiArai 0:a17b3cf2f466 37 myledU = ON;
kenjiArai 0:a17b3cf2f466 38 printf("UN");
kenjiArai 0:a17b3cf2f466 39 while(1) {
kenjiArai 0:a17b3cf2f466 40 wait(5.0);
kenjiArai 0:a17b3cf2f466 41 printf(" passed %4d Sec\r\n", n +=5);
kenjiArai 0:a17b3cf2f466 42 printf("R=ON ,G=OFF,B=OFF ");
kenjiArai 0:a17b3cf2f466 43 myledR = ON;
kenjiArai 0:a17b3cf2f466 44 printf("RN,");
kenjiArai 0:a17b3cf2f466 45 myledG = OFF;
kenjiArai 0:a17b3cf2f466 46 printf("GF,");
kenjiArai 0:a17b3cf2f466 47 myledB = OFF;
kenjiArai 0:a17b3cf2f466 48 printf("BF,");
kenjiArai 0:a17b3cf2f466 49 myledU = OFF;
kenjiArai 0:a17b3cf2f466 50 printf("UF");
kenjiArai 0:a17b3cf2f466 51 wait(5.0);
kenjiArai 0:a17b3cf2f466 52 printf(" passed %4d Sec\r\n", n +=5);
kenjiArai 0:a17b3cf2f466 53 printf("R=OFF,G=OFF,B=OFF ");
kenjiArai 0:a17b3cf2f466 54 myledR = OFF;
kenjiArai 0:a17b3cf2f466 55 printf("RF,");
kenjiArai 0:a17b3cf2f466 56 myledG = OFF;
kenjiArai 0:a17b3cf2f466 57 printf("GF,");
kenjiArai 0:a17b3cf2f466 58 myledB = OFF;
kenjiArai 0:a17b3cf2f466 59 printf("BF,");
kenjiArai 0:a17b3cf2f466 60 myledU = ON;
kenjiArai 0:a17b3cf2f466 61 printf("UN");
kenjiArai 0:a17b3cf2f466 62 wait(5.0);
kenjiArai 0:a17b3cf2f466 63 printf(" passed %4d Sec\r\n", n +=5);
kenjiArai 0:a17b3cf2f466 64 printf("R=OFF,G=ON ,B=OFF ");
kenjiArai 0:a17b3cf2f466 65 myledR = OFF;
kenjiArai 0:a17b3cf2f466 66 printf("RF,");
kenjiArai 0:a17b3cf2f466 67 myledG = ON;
kenjiArai 0:a17b3cf2f466 68 printf("GN,");
kenjiArai 0:a17b3cf2f466 69 myledB = OFF;
kenjiArai 0:a17b3cf2f466 70 printf("BF,");
kenjiArai 0:a17b3cf2f466 71 myledU = OFF;
kenjiArai 0:a17b3cf2f466 72 printf("UF");
kenjiArai 0:a17b3cf2f466 73 wait(5.0);
kenjiArai 0:a17b3cf2f466 74 printf(" passed %4d Sec\r\n", n +=5);
kenjiArai 0:a17b3cf2f466 75 printf("R=OFF,G=OFF,B=OFF ");
kenjiArai 0:a17b3cf2f466 76 myledR = OFF;
kenjiArai 0:a17b3cf2f466 77 printf("RF,");
kenjiArai 0:a17b3cf2f466 78 myledG = OFF;
kenjiArai 0:a17b3cf2f466 79 printf("GF,");
kenjiArai 0:a17b3cf2f466 80 myledB = OFF;
kenjiArai 0:a17b3cf2f466 81 printf("BF,");
kenjiArai 0:a17b3cf2f466 82 myledU = ON;
kenjiArai 0:a17b3cf2f466 83 printf("UN");
kenjiArai 0:a17b3cf2f466 84 wait(5.0);
kenjiArai 0:a17b3cf2f466 85 printf(" passed %4d Sec\r\n", n +=5);
kenjiArai 0:a17b3cf2f466 86 printf("R=OFF,G=OFF,B=ON ");
kenjiArai 0:a17b3cf2f466 87 myledR = OFF;
kenjiArai 0:a17b3cf2f466 88 printf("RF,");
kenjiArai 0:a17b3cf2f466 89 myledG = OFF;
kenjiArai 0:a17b3cf2f466 90 printf("GF,");
kenjiArai 0:a17b3cf2f466 91 myledB = ON;
kenjiArai 0:a17b3cf2f466 92 printf("BN,");
kenjiArai 0:a17b3cf2f466 93 myledU = OFF;
kenjiArai 0:a17b3cf2f466 94 printf("UF");
kenjiArai 0:a17b3cf2f466 95 wait(5.0);
kenjiArai 0:a17b3cf2f466 96 printf(" passed %4d Sec\r\n", n +=5);
kenjiArai 0:a17b3cf2f466 97 printf("R=OFF,G=OFF,B=OFF ");
kenjiArai 0:a17b3cf2f466 98 myledR = OFF;
kenjiArai 0:a17b3cf2f466 99 printf("RF,");
kenjiArai 0:a17b3cf2f466 100 myledG = OFF;
kenjiArai 0:a17b3cf2f466 101 printf("GF,");
kenjiArai 0:a17b3cf2f466 102 myledB = OFF;
kenjiArai 0:a17b3cf2f466 103 printf("BF,");
kenjiArai 0:a17b3cf2f466 104 myledU = ON;
kenjiArai 0:a17b3cf2f466 105 printf("UN");
kenjiArai 0:a17b3cf2f466 106 wait(5.0);
kenjiArai 0:a17b3cf2f466 107 printf(" passed %4d Sec\r\n", n +=5);
kenjiArai 0:a17b3cf2f466 108 printf("R=ON ,G=ON ,B=ON ");
kenjiArai 0:a17b3cf2f466 109 myledR = ON;
kenjiArai 0:a17b3cf2f466 110 printf("RN,");
kenjiArai 0:a17b3cf2f466 111 myledG = ON;
kenjiArai 0:a17b3cf2f466 112 printf("GN,");
kenjiArai 0:a17b3cf2f466 113 myledB = ON;
kenjiArai 0:a17b3cf2f466 114 printf("BN,");
kenjiArai 0:a17b3cf2f466 115 myledU = OFF;
kenjiArai 0:a17b3cf2f466 116 printf("UF");
kenjiArai 0:a17b3cf2f466 117 wait(5.0);
kenjiArai 0:a17b3cf2f466 118 printf(" passed %4d Sec\r\n", n +=5);
kenjiArai 0:a17b3cf2f466 119 printf("R=OFF,G=OFF,B=OFF ");
kenjiArai 0:a17b3cf2f466 120 myledR = OFF;
kenjiArai 0:a17b3cf2f466 121 printf("RF,");
kenjiArai 0:a17b3cf2f466 122 myledG = OFF;
kenjiArai 0:a17b3cf2f466 123 printf("GF,");
kenjiArai 0:a17b3cf2f466 124 myledB = OFF;
kenjiArai 0:a17b3cf2f466 125 printf("BF,");
kenjiArai 0:a17b3cf2f466 126 myledU = ON;
kenjiArai 0:a17b3cf2f466 127 printf("UN");
kenjiArai 0:a17b3cf2f466 128 }
kenjiArai 0:a17b3cf2f466 129 }