Lösung des ESY6/A Praktikums "signal_processing".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sine.c 567B

12345678910111213141516171819202122232425
  1. #include "system/task_sine.h"
  2. #include "system/data_channel.h"
  3. #include "system/float_word.h"
  4. #include <math.h>
  5. #define PI 3.14
  6. int task_sine_run( void * data ) {
  7. sine_config *task = (sine_config*)data;
  8. uint32_t data_channel_base = task->base.sink;
  9. data_channel_clear(data_channel_base);
  10. for (uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i)
  11. {
  12. float_word res;
  13. res.value = task->amplitude * sin( (2*PI*task->samples_per_periode) * i + task->phase);
  14. data_channel_write(data_channel_base, res.word);
  15. }
  16. return 0;
  17. }