#Diagram of TWAI controller signal lines

blockdiag controller_signals_diagram {

    orientation = portrait;
    span_width = 80;

    #Column 1 nodes
    twai[label = "TWAI Controller", fontsize = 15, shape = roundedbox];

    #Column 2 nodes
    tx[label = "TX", shape = endpoint];
    rx[label = "RX", shape = endpoint];
    bus_off[label = "BUS-OFF", shape = endpoint];
    clkout[label = "CLKOUT", shape = endpoint];

    #Column 3 nodes
    hide1 [shape = none];
    hide2 [shape = none];
    hide3 [shape = none];
    hide4 [shape = none];

    group {
        orientation = portrait;
        color = none;

        #Group column 1 nodes vertically
        twai;
    }
    group {
        orientation = portrait;
        color = none;

        #Group column 2 nodes vertically
        tx; rx; bus_off; clkout;
    }
    group {
        orientation = portrait;
        color = none;
        label = "GPIO Matrix";
        fontsize = 20;
        shape = line;

        #Group column 3 nodes vertically
        hide1; hide2; hide3; hide4;
    }

    twai -> tx [folded];
    twai -> rx [folded, dir = none];
    twai -> bus_off [folded];
    twai -> clkout [folded];

    tx -> hide1 [folded];
    rx <- hide2 [folded];
    bus_off -> hide3 [folded, label = "Optional"];
    clkout -> hide4 [folded, label = "Optional"];
}
