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
Fork of STM32FMSynth by
Diff: main.cpp
- Revision:
- 3:83ac767f3a63
- Parent:
- 2:5454dee210ed
- Child:
- 4:1d2a699c95c7
--- a/main.cpp Mon Nov 27 22:05:48 2017 +0000
+++ b/main.cpp Tue Nov 28 23:27:34 2017 +0000
@@ -1,4 +1,5 @@
#include "mbed.h"
+#include "sintable.h"
AnalogOut DAC0(PA_4);//Not labeled in the docs for the f401, but seems to be for all
AnalogOut DAC1(PA_5);
@@ -77,7 +78,13 @@
int carR;
int fastSin(const int phase){
- return 0;
+ int i = phase >> 2;
+ int sum = 0;
+ sum += (phase & 0x3) * sintable[i+1];
+ sum += (0x4 - (phase & 0x3)) * sintable[i];
+ sum = sum >> 2;
+
+ return sum;
}
void synthesize(){
