octofet-device

amperka/octofet/octofet-device

Represents an Octofet board, which provides eight power switches (a.k.a. «channels»).
octofet-device
@/octofet-device
Represents an Octofet board, which provides eight power switches (a.k.a. «channels»).
CSport
The chip select (also known as slave select) pin used to control the shift-register latch. It is marked CS on the Octofet board. Use any GPIO pin of the controller.
MOSIport
The MOSI (Master Out Slave In) pin used to send data to the peripherals. It is marked DI on the Octofet board. Use any GPIO pin of the controller.
SCKport
The clock pin used to clock pulses which synchronize data transmission generated by the master. It is marked П on the Octofet board. Use any GPIO pin of the controller.
octofet-device
CS
MOSI
SCK
DEV
DEV@/octofet-device
To use the node in your project you should have the amperka/octofet library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {
    uint8_t pinCS;
    uint8_t pinMOSI;
    uint8_t pinSCK;
};

using Type = State*;

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto dev = getState(ctx);
    dev->pinCS = getValue<input_CS>(ctx);
    dev->pinMOSI = getValue<input_MOSI>(ctx);
    dev->pinSCK = getValue<input_SCK>(ctx);
    pinMode(dev->pinCS, OUTPUT);
    pinMode(dev->pinMOSI, OUTPUT);
    pinMode(dev->pinSCK, OUTPUT);
    emitValue<output_DEV>(ctx, dev);
}