Commit 2521e8d3 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Some more trinamic stuff in the block

parent 87a30f7f
......@@ -23,6 +23,7 @@
#include <ec/ec.h>
#include <ec/esc.h>
#include <ec/esc_coe.h>
#include <ec/esc_esi.h>
#include <ec/esc_id.h>
#include <log/log.h>
......@@ -30,8 +31,10 @@
struct controller_block_private {
unsigned char *rx_buffer;
unsigned char *tx_buffer;
struct esc_device *dev;
struct canopen_dev *candev;
};
......@@ -40,6 +43,10 @@ static void callback_rx(struct controller_block *block, void *data)
block->private->rx_buffer = data;
}
static void callback_tx(struct controller_block *block, void *data)
{
block->private->tx_buffer = data;
}
struct trinamic_type {
char *name;
......@@ -51,6 +58,16 @@ static struct trinamic_type devlist[] = {
{ "TMC8460EVAL", ESC_ESI_PRODUCTCODE_TRINAMIC_TMC8460_EVAL },
};
static int pre_operational_hook(struct esc_device *esc)
{
struct controller_block *block = esc->block;
if (!block->private->candev)
block->private->candev = esc_coe_create(esc);
return 0;
}
static struct controller_block * block_trinamic_tmc8460eval_create(char *name, int argc, va_list ap)
{
struct controller_block *block;
......@@ -94,8 +111,12 @@ static struct controller_block * block_trinamic_tmc8460eval_create(char *name, i
block->private->dev = esc;
esc->block = block;
esc->block_rx = block;
esc->block_tx = block;
esc_esi_device_fill(esc);
esc->callback_rx = callback_rx;
esc->callback_tx = callback_tx;
esc->pre_operational_hook = pre_operational_hook;
esc_device_initialize_operational(esc);
if (controller_block_add(block))
......
# simple set of inputs and outputs to test ethercat stack
trigger {
{ "default" }
}
blocks (1000.0, 0.0) {
{ "ec", "ethercat", "eth0", 1, 1 }
{ "trinamic_tmc8460eval", "eval", "ethercat", 0, "TMC8460EVAL" }
}
blocks (2.0, 0.0) {
{ "not", "osc" }
}
links {
{ "osc", "output", "osc", "input", false }
}
Markdown is supported
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