2023-10-31 07:47:27 +01:00
|
|
|
#include "system/task_sine.h"
|
|
|
|
#include "system/data_channel.h"
|
|
|
|
#include "system/float_word.h"
|
2024-12-04 08:58:18 +01:00
|
|
|
#include <math.h>
|
2023-10-31 07:47:27 +01:00
|
|
|
|
|
|
|
int task_sine_run( void * data ) {
|
|
|
|
|
2024-12-04 08:58:18 +01:00
|
|
|
// Nachfolgende Anweisungen Schreiben 1024 Mal den Wert 4 in den FIFO für Sinus
|
|
|
|
sine_config * task = ( sine_config * ) data;
|
|
|
|
uint32_t data_channel_base = task->base.sink;
|
|
|
|
data_channel_clear( data_channel_base );
|
2023-10-31 07:47:27 +01:00
|
|
|
|
2024-12-04 08:58:18 +01:00
|
|
|
for( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; i++ ) {
|
|
|
|
float_word res;
|
|
|
|
res.value = task->amplitude * sin((2 * M_PI / task->samples_per_periode) * i + task->phase );
|
|
|
|
|
|
|
|
data_channel_write( data_channel_base, res.word );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2023-10-31 07:47:27 +01:00
|
|
|
}
|