Implemented and tested Task Sine in C
This commit is contained in:
parent
344619c957
commit
45e909c886
@ -2,9 +2,21 @@
|
|||||||
#include "system/data_channel.h"
|
#include "system/data_channel.h"
|
||||||
#include "system/float_word.h"
|
#include "system/float_word.h"
|
||||||
|
|
||||||
int task_sine_run( void * data ) {
|
#include <math.h>
|
||||||
|
|
||||||
// TODO
|
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);
|
||||||
|
|
||||||
|
data_channel_write(data_chnl_base, result.word);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user