The FastLED library does not yet support the NAN033 BLE boards, so I'm trying to refactor this nice fadeTowardColor solution by Mark Kriegsman for use with the standard Adafruit_NeoPixel library.
I think I'm mostly there, but getting tripped up on the FastLED libraries scale8_video function.
I've pulled it out and rejiggered it like so:
uint8_t scale8_video33( uint8_t i, uint8_t scale)
{
uint8_t j=0;
asm volatile(
" tst %[i]\n\t"
" breq L_%=\n\t"
" mul %[i], %[scale]\n\t"
" mov %[j], r1\n\t"
" clr __zero_reg__\n\t"
" cpse %[scale], r1\n\t"
" subi %[j], 0xFF\n\t"
"L_%=: \n\t"
: [j] "+a" (j)
: [i] "a" (i), [scale] "a" (scale)
: "r0", "r1"
);
return j;
}
which compiles and runs nicely on my UNO R3 testbed, but throws a compile error when trying to get it onto my NANO33 BLE:
impossible constraint in 'asm'
Admittedly, this function is a tad above my pay grade, and I don't know exactly what it's trying to do, so I don't know if it's fixable to compile for a nRF52840 or how to attack it.
Anyone a little more familiar with ASM able to help?
In the FastLED library, the function does have one compiletime conditional
#if SCALE8_C == 1 || defined(LIB8_ATTINY)
uint8_t j = (((int)i * (int)scale) >> 8) + ((i&&scale)?1:0);
return j;
#elif SCALE8_AVRASM == 1
<the above code here>
Presumably to switch between a pure C solution (though not quite sure why the check for ATTINY) and an AVRASM. From the error message, it seems like the NANO33 would support ASM, but it's just being invoked incorrectly.