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 sets mPinMask, mPort, and mInPort to NULL instead of using digitalPinToBitMask(), portOutputRegister(digitalPinToPort(mPin)), and portInputRegister(digitalPinToPort(mPin)) (respectively)
- public functions setOutput() and setInput() are given empty function bodies
- additional public function added: setPin(int pin) (sets member and calls _init())
- removes public functions strobe() and toggle()
- removes public functions void hi(register port_ptr_t port) and void 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.
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:
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.