Browse Source

Implemented and tested Task Sine in C

master
schoeffelbe82781 1 week ago
parent
commit
45e909c886
1 changed files with 13 additions and 1 deletions
  1. 13
    1
      software/signal_processing/sine.c

+ 13
- 1
software/signal_processing/sine.c View File

@@ -2,9 +2,21 @@
#include "system/data_channel.h"
#include "system/float_word.h"

#include <math.h>

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;
}

Loading…
Cancel
Save