32 lines
651 B
C
32 lines
651 B
C
#include "system/task_sine.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>
|
|
|
|
|
|
//int data_channel_write(uint32_t base, uint32_t value);
|
|
|
|
|
|
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) * sin((2*M_PI*i)/(task->samples_per_periode)+task->phase);
|
|
data_channel_write(data_channel_base, res.word);
|
|
}
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
|