|
|
|
|
|
|
|
|
#include "system/data_channel.h" |
|
|
#include "system/data_channel.h" |
|
|
#include "system/float_word.h" |
|
|
#include "system/float_word.h" |
|
|
|
|
|
|
|
|
|
|
|
#include <math.h> |
|
|
|
|
|
|
|
|
int task_sine_run( void * data ) { |
|
|
int task_sine_run( void * data ) { |
|
|
|
|
|
sine_config* task = (sine_config*) data; |
|
|
|
|
|
|
|
|
|
|
|
uint32_t data_chnl_base = task->base.sink; |
|
|
|
|
|
data_channel_clear(data_chnl_base); |
|
|
|
|
|
|
|
|
|
|
|
for(uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i) { |
|
|
|
|
|
float_word result; |
|
|
|
|
|
result.value = task->amplitude * sin(task->phase + ((2 * M_PI)/(double)task->samples_per_periode) * i); |
|
|
|
|
|
|
|
|
// TODO |
|
|
|
|
|
|
|
|
data_channel_write(data_chnl_base, result.word); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |