Commit 4874c588 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Add seperate rx block

parent f1e90f9d
......@@ -181,22 +181,30 @@ static struct controller_block * block_vesp_controller_create(char *name,
struct controller_block *controller;
struct controller_block *controller_tx;
struct controller_block *controller_rx;
char *busname = va_arg(ap, char *);
uint8_t address = va_arg(ap, int);
uint8_t vid, dev;
char *name_tx;
char *name_tmp;
int i;
asprintf(&name_tx, "%s_tx", name);
if (!(controller = controller_block_alloc("vesp_controller", name, sizeof(struct controller_block_private))))
return NULL;
if (!(controller_tx = controller_block_alloc("vesp_controller_tx", name_tx, 0)))
asprintf(&name_tmp, "%s_rx", name);
if (!(controller_rx = controller_block_alloc("vesp_controller_rx", name_tmp, 0)))
goto err_controller;
controller_rx->private = controller->private;
asprintf(&name_tmp, "%s_tx", name);
if (!(controller_tx = controller_block_alloc("vesp_controller_tx", name_tmp, 0)))
goto err_controller;
controller_tx->private = controller->private;
controller->calculate = calculate_controller_rx;
controller_rx->calculate = calculate_controller_rx;
controller_tx->calculate = calculate_controller_tx;
if (controller_block_outterm_list_init(controller, outterms))
......@@ -205,6 +213,9 @@ static struct controller_block * block_vesp_controller_create(char *name,
if (controller_block_interm_list_init(controller_tx, interms))
goto err_block;
controller->outputs = controller_rx->outputs;
controller->output = controller_rx->output;
controller->inputs = controller_tx->inputs;
controller->input = calloc(controller->inputs, sizeof(struct controller_block_interm));
if (!controller->input)
......@@ -251,6 +262,10 @@ static struct controller_block * block_vesp_controller_create(char *name,
if (controller_block_add(controller))
goto err_add;
if (controller_block_add(controller_rx))
goto err_add;
if (controller_block_add(controller_tx))
goto err_add;
return controller;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment