Skip to content

Add Sleep\Wake feature #8

Open
Open
@chinswain

Description

@chinswain

I've attempted to add the sleep\wake feature:
https://github.com/chinswain/SparkFun_SCD4x_Arduino_Library

added to .h

  bool scd4x_power_down(void);
  uint8_t scd4x_wake_up(void);

added to .cpp

bool scd4x_power_down() {
    Wire.beginTransmission(SCD4x_ADDRESS);
    Wire.write(0x36);
    Wire.write(0xE0);
    int error = Wire.endTransmission();

    if (error) {
        return error;
    }

    delayMicroseconds(1000);  // Sleep for 1000 microseconds
    return (true);
}

int16_t scd4x_wake_up() {
    Wire.beginTransmission(SCD4x_ADDRESS);
    Wire.write(0x36);
    Wire.write(0xF6);
    (void)Wire.endTransmission();  // Ignore the error as per the original function

    delay(20);  // Sleep for 20 milliseconds
    return (true);
}

Docs: https://sensirion.com/media/documents/E0F04247/631EF271/CD_DS_SCD40_SCD41_Datasheet_D1.pdf

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions