in libs/display/leds.cpp [42:100]
void setMatrixLeds(int led, bool value) {
if (!init) {
init = true;
if (!pxt::IsPulse()) {
auto en = lookupPin(PA_9);
en->setDigitalValue(1);
const uint32_t pinArray[] = { BRAINPAD_TICK_LED1 , BRAINPAD_TICK_LED2 , BRAINPAD_TICK_LED3 , BRAINPAD_TICK_LED4 , BRAINPAD_TICK_LED5 ,
BRAINPAD_TICK_LED6 , BRAINPAD_TICK_LED7 , BRAINPAD_TICK_LED8 , BRAINPAD_TICK_LED9 , BRAINPAD_TICK_LED10,
BRAINPAD_TICK_LED11, BRAINPAD_TICK_LED12, BRAINPAD_TICK_LED13, BRAINPAD_TICK_LED14, BRAINPAD_TICK_LED15,
BRAINPAD_TICK_LED16, BRAINPAD_TICK_LED17, BRAINPAD_TICK_LED18, BRAINPAD_TICK_LED19, BRAINPAD_TICK_LED20,
BRAINPAD_TICK_LED21, BRAINPAD_TICK_LED22, BRAINPAD_TICK_LED23, BRAINPAD_TICK_LED24, BRAINPAD_TICK_LED25};
for (int i = 0; i < 25; i++) {
pixel[i] = new _mbed::Pin(0, pinArray[i], PIN_CAPABILITY_DIGITAL);
}
}
}
if (!pxt::IsPulse()) {
if (led < 0)
return;
if (led > 66)
return;
pixel[led]->setDigitalValue(value);
}
else {
if (value == 0)
return ;
const int ledWidth = (64 / 5);
const int ledHeight = (64 / 5);
int xSrc = (led % 5);
int ySrc = (led / 5);
int xDest = xSrc * ledWidth;
int yDest = ySrc * ledHeight;
int xStart = xDest + 34 + 1;
int xEnd = xStart + ledWidth-1;
int yStart = yDest+1;
int yEnd = yStart + ledHeight-1;
for (int y = yStart; y < yEnd; y++) {
for (int x = xStart; x < xEnd; x++) {
pxt::NativeSetPixelToBuffer(x, y, 1);
}
}
}
}