Browse Source

sine.c

master
dan1b8 2 weeks ago
parent
commit
6fad6f054c
1 changed files with 16 additions and 1 deletions
  1. 16
    1
      software/signal_processing/sine.c

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

#include "system/data_channel.h" #include "system/data_channel.h"
#include "system/float_word.h" #include "system/float_word.h"


#include <math.h>

#define PI 3.14

int task_sine_run( void * data ) { int task_sine_run( void * data ) {


// TODO
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*PI*task->samples_per_periode) * i + task->phase);

data_channel_write(data_channel_base, res.word);
}


return 0; return 0;
} }

Loading…
Cancel
Save