scd30-device

wayland/scd30-co2-rh-temp/scd30-device

Create SCD30 device.
scd30-device
@/scd30-device
Create SCD30 device.
scd30-device
DEV
DEV@/scd30-device
An SCD30 device.
To use the node in your project you should have the wayland/scd30-co2-rh-temp 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

// Tell XOD where it could download the library:
#pragma XOD require "https://github.com/WaylandM/SparkFun_SCD30_Arduino_Library"

//Include C++ libraries
{{#global}}
#include <Wire.h>
#include <SparkFun_SCD30_Arduino_Library.h>
{{/global}}

// Reserve memory to store an instance of the class,
// and create the instance later:
struct State {
    uint8_t mem[sizeof(SCD30)];
};

// Define our custom type as a pointer on the class instance.
using Type = SCD30*;

{{ 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 airSensor = new (state->mem) SCD30();

    emitValue<output_DEV>(ctx, airSensor);
}