schmidtsv99309 7dd0ffc130 Fertig
2024-12-18 10:56:27 +01:00

31 lines
757 B
C

#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"
#include <math.h>
#include <stdio.h>
#include <limits.h>
#include <system.h>
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;
for(uint32_t y = 0; y < task->samples_per_periode; y++)
{
res.value = task->amplitude * sin(2*3.14/task->samples_per_periode*y + task->phase);
data_channel_write( data_channel_base, res.word );
}
}
return 0;
}