29 lines
718 B
C
29 lines
718 B
C
#include "system/task_add.h"
|
|
#include "system/data_channel.h"
|
|
#include "system/float_word.h"
|
|
|
|
int task_add_run( void * task )
|
|
{
|
|
// Die Task-Einstellungen liegen als task_base_config vor
|
|
task_base_config *config = (task_base_config *) task;
|
|
|
|
for (uint32_t i = 0; i < DATA_CHANNEL_DEPTH; i++) {
|
|
|
|
float_word a, b, c;
|
|
|
|
// aus Quelle 0 lesen
|
|
data_channel_read(config->sources[0], &a.word);
|
|
// aus Quelle 1 lesen
|
|
data_channel_read(config->sources[1], &b.word);
|
|
|
|
// Addition der beiden Float-Werte
|
|
c.value = a.value + b.value;
|
|
|
|
// Ergebnis in den Ziel-Data-Channel schreiben
|
|
data_channel_write(config->sink, c.word);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|