setup

wayland/max30102-pulse-oximeter/setup

Configure MAX30102 sensor.
setup
@/setup
Configure MAX30102 sensor.
DEV@/max30102-device
A MAX30102 device.
PWRbyte
Power level (LED brightness). Options: 0=Off to 255=50mA.
SAbyte
Sample Average. Options: 1, 2, 4, 8, 16, 32.
LEDbyte
LED mode. Options: 1 = Red only, 2 = Red + IR, 3 = Red + IR + Green.
SRnumber
Sample Rate. Options: 50, 100, 200, 400, 800, 1000, 1600, 3200.
PWnumber
Pulse Width. Options: 69, 118, 215, 411.
ADCnumber
ADC range. Options: 2048, 4096, 8192, 16384.
UPDpulse
Update. Triggers setup.
setup
DEV
PWR
SA
LED
SR
PW
ADC
UPD
DONE
DONEpulse
Pulse on completion of setup.
To use the node in your project you should have the wayland/max30102-pulse-oximeter 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 {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // The node responds only if there is an input pulse
    if (!isInputDirty<input_UPD>(ctx))
        return;

    // Get a pointer to the `MAX30105` class instance
    auto sensor = getValue<input_DEV>(ctx);

    sensor->setup(getValue<input_PWR>(ctx),
                  getValue<input_SA>(ctx),
                  getValue<input_LED>(ctx),
                  getValue<input_SR>(ctx),
                  getValue<input_PW>(ctx),
                  getValue<input_ADC>(ctx));
    emitValue<output_DONE>(ctx,1);
}