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.
Revision 3:f7923b9e8611, committed 2017-11-21
- Comitter:
- roland_tmm
- Date:
- Tue Nov 21 19:57:07 2017 +0000
- Parent:
- 2:602f7589c53e
- Commit message:
- Edited main.cpp: corrected multi-threading error
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Nov 21 19:18:25 2017 +0000
+++ b/main.cpp Tue Nov 21 19:57:07 2017 +0000
@@ -13,7 +13,8 @@
double DDStrimFreq = 124999500; //frequency used by AD9850 to calibrate
int DDSphase = 0; //phase for the AD9850
-Thread thread; //create thread to allow simultaneous LED blink and DDS output
+Thread GENthread; //create thread to allow simultaneous LED blink and DDS output
+Thread LEDthread;
//AD9833 LED thread
void GENBlinkThread() {
@@ -37,8 +38,8 @@
int main() {
- thread.start(callback(GENBlinkThread));
- thread.start(callback(DDSBlinkThread));
+ GENthread.start(callback(GENBlinkThread));
+ LEDthread.start(callback(DDSBlinkThread));
// Sequence to follow to generate waveform using AD9833
gen.Begin(); // The loaded defaults are 1000 Hz SINE_WAVE using REG0
@@ -54,5 +55,7 @@
dds.CalibrateDDS(DDStrimFreq); //calibrate to match crystal oscillator
dds.SetDDSFrequency(DDSfreq, DDSphase);
+ GENthread.join(); //wait for the threads to finish
+ LEDthread.join();
while(1);
}