Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include <mbed.h> 00002 #include <scmRTOS.h> 00003 00004 Serial pc(USBTX, USBRX); 00005 00006 // process types 00007 typedef OS::process<OS::pr0, 1000> TProc1; 00008 typedef OS::process<OS::pr1, 1000> TProc2; 00009 00010 // process objects 00011 TProc1 Proc1; 00012 TProc2 Proc2; 00013 00014 //--------------------------------------------------------------------------- 00015 long long count = 0; 00016 00017 int main() { 00018 pc.baud(115200); 00019 printf("\nInitialising ...\n"); 00020 OS::Run(); 00021 } 00022 00023 //--------------------------------------------------------------------------- 00024 template<> OS_PROCESS void TProc1::Exec() { 00025 for (;;) { 00026 Sleep(2000); 00027 printf("[1] %lld\n", count); 00028 } 00029 } 00030 00031 //--------------------------------------------------------------------------- 00032 template<> OS_PROCESS void TProc2::Exec() { 00033 for (;;) { 00034 Sleep(2000); 00035 printf("[2] %lld\n", count); 00036 } 00037 } 00038 00039 //--------------------------------------------------------------------------- 00040 void OS::SystemTimerUserHook() { 00041 ++count; 00042 if (count % 2000 == 0) { 00043 printf("\n%lld\n", count); 00044 } 00045 } 00046 00047 //--------------------------------------------------------------------------- 00048 void OS::IdleProcessUserHook() { 00049 __WFI(); 00050 }
Generated on Tue Jul 12 2022 21:14:46 by
1.7.2