433-device

bradzilla84/433mhz-rcswitch/433-device

Device setup.
433-device
@/433-device
Device setup.
433-device
OUT
OUT@/433-device
To use the node in your project you should have the bradzilla84/433mhz-rcswitch 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

#pragma XOD require "https://github.com/sui77/rc-switch"

{{#global}}
#include <RCSwitch.h>
{{/global}}

struct State {
    uint8_t mem[sizeof(RCSwitch)];
};

using Type = RCSwitch*;

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // It should be evaluated only once on the first (setup) transaction
    if (!isSettingUp())
        return;

    auto state = getState(ctx);
    // Create a new object in the memory area reserved previously.
    Type rcswitch = new (state->mem) RCSwitch();
    emitValue<output_OUT>(ctx, rcswitch);
}