Repository navigation
Description
Can you help me understand the purpose and reasoning behind FASTLED_NO_PINMAP?
I'm walking through the steps to port FastLED. I'm normally able to divine(*) the purpose of the #define options. However, I'm stumped as to the purpose of FASTLED_NO_PINMAP.
The only platforms that #define FASTLED_NO_PINMAP are STM32 and NRF51.
There are only two conditional compilations, both in fastpin.h.
The first wraps a NEARLY identical definition of the Pin class. When FASTLED_NO_PINMAP is defined, the class has the following differences:
- private
_init()function setsmPinMask,mPort, andmInPorttoNULLinstead of usingdigitalPinToBitMask(),portOutputRegister(digitalPinToPort(mPin)), andportInputRegister(digitalPinToPort(mPin))(respectively) - public functions
setOutput()andsetInput()are given empty function bodies - additional public function added:
setPin(int pin)(sets member and calls_init()) - removes public functions
strobe()andtoggle() - removes public functions
void hi(register port_ptr_t port)andvoid lo(register port_ptr_t port)
Otherwise, the classes are identical. Based on the above, one guess I came up with is that, when porting to a new board, one would sub-class the above Pin class, and override the functions _init(), setOutput(), and setInput(). But, I can't find where the Pin class would actually be instantiated in FastLED. Thus, it seems unsatisfactory.
My other guess is that this is to enable support for non-Arduino environments, by providing the digitalPinToBitMask(), digitalPinToPort(), portOutputRegister(), and portInputRegister() capabilities that Arduino would normally provide. But, this also seems somewhat unsatisfactory.
Your help understanding this will be appreciated...
(*) the brute-force way, reviewing the code where they are checked. A slow way to learn the code base, but it's a start.
Activity
focalintent commentedon Apr 6, 2019
FASTLED_NO_PINMAP is mostly a thing I use to keep things building when on platforms that don't provide the portOutputRegister and friend functions.
Realistically though, it's moot - nothing in FastLED uses the Pin classes, with the exception of some old debugging code in the power management code (in fact in the overhaul I'm doing for RGBW and friends, I won't even have those classes around anymore).
The STM32 and NRF51 ports were both started in environments with no Arduino around (they were contract jobs for private, other build environment ports of FastLED), which is why they have it defined.
focalintent commentedon Apr 6, 2019
(The FastPin classes/implementations are the important ones that FastLED uses)
henrygab commentedon Apr 6, 2019
Thanks for taking the time to help me understand. It helps me retain some sanity, knowing that this really and truly isn't (really) being used. Moving on...