This commit is contained in:
meyerko91320 committed 2026-11-19 10:27:52 +01:00
1 parent a9fe0df1f2
commit 5ec9d4c9b8
1 file changed
+22 -3
+22 -3
View File
@@ -1,10 +1,29 @@
#include "system/task_sine.h"
#include "system/hardware_task.h"
#include "system/sine_config.h"
#include "system/data_channel.h"
#include "system/float_word.h"
int task_sine_run( void * data ) {
#include <math.h>
#include <stdio.h>
#include <limits.h>
#include <system.h>
// TODO
#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 );
data_channel_write( data_channel_base, res.word );
}
return 0;
}
}