Browse Source

Some more trinamic stuff in the block

jeroen
Jeroen Vreeken 3 years ago
parent
commit
2521e8d339
2 changed files with 42 additions and 0 deletions
  1. +21
    -0
      controller/ec/block_trinamic_tmc8460eval.c
  2. +21
    -0
      controller/ec/trinamic.ctrl

+ 21
- 0
controller/ec/block_trinamic_tmc8460eval.c View File

@ -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))


+ 21
- 0
controller/ec/trinamic.ctrl View File

@ -0,0 +1,21 @@
# 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 }
}

Loading…
Cancel
Save