22 lines
508 B
C
Raw Normal View History

2023-10-31 07:47:27 +01:00
#include "system/task_add.h"
#include "system/data_channel.h"
#include "system/float_word.h"
int task_add_run( void * task ) {
add_config* taskConfig = (add_config*) task;
2023-10-31 07:47:27 +01:00
for(uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i) {
float chnl1, chnl2;
data_channel_read(taskConfig->sources[0], (uint32_t*) &chnl1);
data_channel_read(taskConfig->sources[1], (uint32_t*) &chnl2);
float_word result;
result.value = chnl1 + chnl2;
data_channel_write(taskConfig->sink, result.word);
}
2023-10-31 07:47:27 +01:00
return 0;
}