static void showCode()

in libs/circuit-playground/panic.cpp [4:27]


static void showCode(int statusCode) {
    auto neoPin = LOOKUP_PIN(NEOPIXEL);
    if (!neoPin)
        return;

    int numNeopixels = getConfig(CFG_NUM_NEOPIXELS, 0);
    if (numNeopixels <= 0)
        return;
    int size = numNeopixels * 3;
    uint8_t neobuf[size];
    memset(neobuf, 0, size);

    for (int i = 0; i < 10; ++i) {
        if (i < numNeopixels)
            memcpy(&neobuf[i * 3], (statusCode & (1 << i)) ? "\x00\x04\x00" : "\x00\x00\x01",
                   3);
    }

    neoPin->setDigitalValue(0);
    target_wait(1);

    neopixel_send_buffer(*neoPin, neobuf, size);
    target_disable_irq();
}