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 "SETUP.hpp" 00002 Ticker frequency_ticker; 00003 //Can only use 3 threads including main 00004 void Frequency_set() 00005 { 00006 OUTPUT_THREAD.signal_set(1);//Sets the output thread to output data every time this interrupt is run 00007 //This interrupt is set to run from a ticker 00008 } 00009 00010 void Output_Thread_Function() 00011 { 00012 while(1) 00013 { 00014 Thread::signal_wait(1); 00015 OUTPUT_THREAD.signal_set(0); 00016 //pc.printf("In output thread function\n"); 00017 DRIVER_1.Output_Sine_Wave(); 00018 Thread::wait(1);//Small wait 00019 } 00020 } 00021 void Input_Thread_Function() 00022 { 00023 while(1) 00024 { 00025 Thread::signal_wait(1); 00026 //pc.printf("In input thread function\n"); 00027 Thread::wait(1000); 00028 } 00029 } 00030 int main() 00031 { 00032 pc.printf("Outputing data to serial\n"); 00033 00034 DRIVER_1.Sine_Lookup_Table_Generator(); 00035 Thread::wait(1000); 00036 OUTPUT_THREAD.start(Output_Thread_Function); 00037 INPUT_THREAD.start(Input_Thread_Function); 00038 frequency_ticker.attach(&Frequency_set,0.0002f);//Sets the frequency to 50Hz 00039 while(1) 00040 { 00041 Thread::signal_wait(1); 00042 myled = !myled; 00043 //pc.printf("In main thread\n"); 00044 Thread::wait(1000); 00045 00046 } 00047 }
Generated on Fri Jul 22 2022 04:09:08 by
1.7.2