This commit is contained in:
meyerko91320 committed 2026-11-19 10:47:26 +01:00
1 parent 5ec9d4c9b8
commit 93f7eea2fe
1 file changed
+13 -4
+13 -4
View File
@@ -9,18 +9,27 @@
#include <limits.h>
#include <system.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif
int task_sine_run( void * data ) {
sine_config * task = ( sine_config * ) data;
uint32_t data_channel_base = task->base.sink;
data_channel_clear( data_channel_base );
for ( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i ) {
float_word res;
res.value = task->amplitude * sinf( ( 2.0f * M_PI * i ) / task->samples_per_periode + task->phase );
//
res.value = task->amplitude * // AMPLITUDE DER WELLE FESTLEGEN
sinf(
( 2.0f * M_PI * i ) // 1. UMRECHNUNG IN BOGENMAß
/ ( float )task->samples_per_periode // 2. ANZAHL DER SAMPLES PRO PERIODE
+ task->phase // PHASENVERSCHIEBUNG ADDIEREN
);
//
data_channel_write( data_channel_base, res.word );
}