Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setLedColor is defined below sleep where it's called #7

Open
GoobyCorp opened this issue Oct 20, 2018 · 0 comments
Open

setLedColor is defined below sleep where it's called #7

GoobyCorp opened this issue Oct 20, 2018 · 0 comments

Comments

@GoobyCorp
Copy link

void sleep(int errorCode) {
// Turn off all LEDs and go to sleep. To launch another payload, press the reset button on the device.
//delay(100);
digitalWrite(PIN_LED_RXL, HIGH);
digitalWrite(PIN_LED_TXL, HIGH);
digitalWrite(ONBOARD_LED, LOW);
if (errorCode == 1) {
setLedColor("green"); //led to red
delayMicroseconds(LED_CONFIRM_TIME_us);
setLedColor("black"); //led to off
} else {
setLedColor("red"); //led to red
delayMicroseconds(LED_CONFIRM_TIME_us);
setLedColor("black"); //led to off
}
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; /* Enable deepsleep */
GCLK->CLKCTRL.reg = uint16_t(
GCLK_CLKCTRL_CLKEN |
GCLK_CLKCTRL_GEN_GCLK2 |
GCLK_CLKCTRL_ID( GCLK_CLKCTRL_ID_EIC_Val )
);
while (GCLK->STATUS.bit.SYNCBUSY) {}
__DSB(); /* Ensure effect of last store takes effect */
__WFI(); /* Enter sleep mode */
}
void setLedColor(const char color[]) {
if (color == "red") {
strip.setPixelColor(0, 64, 0, 0);
} else if (color == "green") {
strip.setPixelColor(0, 0, 64, 0);
} else if (color == "orange") {
strip.setPixelColor(0, 64, 32, 0);
} else if (color == "blue") {
strip.setPixelColor(0, 0, 0, 64);
} else if (color == "black") {
strip.setPixelColor(0, 0, 0, 0);
} else {
strip.setPixelColor(0, 255, 255, 255);
}
strip.show();
}

setLedColor is inaccessible because it's defined below where it's called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant