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.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 //~~~~~~~~~~~~~~~~~~~~~~~~~~~GPIO registor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00004 DigitalOut led = D13; //link leg 00005 //~~~~~~~~~~~~~~~~~~~~~~~~~~~end of GPIO registor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00006 00007 00008 //~~~~~~~~~~~~~~~~~~~~~~~~~~~Varible registor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00009 Ticker TT1; //call a timer 00010 Ticker TT2; //call a timer 00011 //~~~~~~~~~~~~~~~~~~~~~~~~~~~end of Varible registor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00012 00013 00014 //~~~~~~~~~~~~~~~~~~~~~~~~~~~Function registor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00015 void init_IO(); //initialize IO state 00016 void init_TIMER(); //set TT_main{} rate 00017 void TT1_main(); //timebase function rated by TT1 00018 void TT2_main(); //timebase function rated by TT2 00019 //~~~~~~~~~~~~~~~~~~~~~~~~~~~end of Function registor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00020 00021 00022 //~~~~~~~~~~~~~~~~~~~~~~~~~~~main funtion~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00023 int main() 00024 { 00025 init_IO(); //initialized value 00026 init_TIMER(); //initialized Timer Inturrupt rate 00027 00028 while(1) { //main() loop 00029 } 00030 } 00031 //~~~~~~~~~~~~~~~~~~~~~~~~~~~end of main funtion~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00032 00033 00034 //~~~~~~~~~~~~~~~~~~~~~~~~~~~init_IO funtion~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00035 void init_IO(void) //initialize 00036 { 00037 led = 1; 00038 } 00039 //~~~~~~~~~~~~~~~~~~~~~~~~~~~end of init_IO funtion~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00040 00041 00042 00043 //~~~~~~~~~~~~~~~~~~~~~~~~~~~Timebase funtion~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 00044 void init_TIMER() //set TTx_main{} rate 00045 { 00046 TT1.attach_us(&TT1_main, 1000); 00047 TT2.attach_us(&TT2_main, 1001); 00048 } 00049 00050 void TT1_main() //interrupt function by TT1 00051 { 00052 led = !led; 00053 } 00054 00055 void TT2_main() //interrupt function by TT2 00056 { 00057 led = !led; 00058 } 00059 //~~~~~~~~~~~~~~~~~~~~~~~~~~~end of Timebase funtion~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
Generated on Fri Jul 15 2022 19:05:11 by
1.7.2