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

int task_add_run( void * task ) {

	add_config * config = (add_config*)task;

	for (int i = 0; i < DATA_CHANNEL_DEPTH; i++)
	{
 		float value_1;
    		float value_2;	
		float_word value_3;

		data_channel_read(config->sources[0], &value_1);
		data_channel_read(config->sources[1], &value_2);

		value_3.value = value_1 + value_2;

		data_channel_write(config->sink, (uint32_t)value_3.word);
	}

    	return 0;
}

