Ray Liu
/
NuMaker-mbed-OS-Core-RTOS-Basic
Modify the file main.cpp for M487
Revision 0:0dfa64725959, committed 2017-09-29
- Comitter:
- shliu1
- Date:
- Fri Sep 29 05:44:18 2017 +0000
- Commit message:
- main.cpp adds the setting of TARGET_NUMAKER_PFM_M487 for M487
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Fri Sep 29 05:44:18 2017 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Fri Sep 29 05:44:18 2017 +0000 @@ -0,0 +1,16 @@ +# Getting started thread with LEDs on mbed OS + + +### Import NuMaker-mbed-OS-Core-RTOS-Basic from on-line IDE +1. Please choose Nuvoton NuMaker-PFM-XXX as your target platform. +2. Please press the left-up icon "New", then choose "NuMaker mbed RTOS basic (Thread)" from the template list. +3. Your NuMaker-mbed-OS-Core-RTOS-Basic program is existed. + +#### Now compile +Please press compile icon. + +#### Burn Code & Execute +1. Connect the board NuMaker-PFM-XXX with your PC by USB cable, then there will be one "mbed" disk. +2. Copy the built binary file into "mbed" disk on you PC. +3. Press device's reset button to execute, LED1 and LED2 will flash on. + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 29 05:44:18 2017 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "rtos.h" +#if defined(TARGET_NUMAKER_PFM_NUC472) +DigitalOut led1(LED1); +DigitalOut led2(LED2); +#elif defined(TARGET_NUMAKER_PFM_M453) +DigitalOut led1(LED1); +DigitalOut led2(LED2); +#elif defined(TARGET_NUMAKER_PFM_M487) +DigitalOut led1(LED1); +DigitalOut led2(LED2); +#endif + +void led2_thread(void const *args) { + while (true) { + led2 = !led2; + Thread::wait(1000); + } +} + +int main() { + Thread thread(led2_thread); + + while (true) { + led1 = !led1; + Thread::wait(500); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Fri Sep 29 05:44:18 2017 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#ca661f9d28526ca8f874b05432493a489c9671ea