6 years, 6 months ago.  This question has been closed. Reason: Duplicate question

mbed OS 5.0 版本後,是否預設就是 RTOS (ARM RTX) ?

以下為官方標準範例,預設 main()就是第一個thread...

mbed-os-example-blinky

#include "mbed.h"
 
DigitalOut led1(LED1);
 
// main() runs in its own thread in the OS
int main() {
    while (true) {
        led1 = !led1;
        wait(0.5);
    }
}

以下為Nuvoton的範例程式...

NuMaker-mbed-OS-Core-RTOS-Basic

#include "mbed.h"
#include "rtos.h"
 
DigitalOut led1(LED1);
DigitalOut led2(LED2);
 
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);
    }
}

這樣我有些疑問 ?

1. 使用 RTOS (ARM RTX) 是否不再需要 include "rtos.h" ?

2. 一般使用 wait() 是否就等同於 Thread::wait() ?

3. 使用 "PlatformMutex.h" 的 mutex 是否就等同於 RTOS (ARM RTX) 的mutex ?