SpenceKonde / megaTinyCore

Arduino core for the tinyAVR 0/1/2-series - Ones's digit 2,4,5,7 (pincount, 8,14,20,24), tens digit 0, 1, or 2 (featureset), preceded by flash in kb. Library maintainers: porting help available!
Other
542 stars 140 forks source link

Change some variables in tinyNeoPixel from private to protected #1103

Open moose4lord opened 1 month ago

moose4lord commented 1 month ago

Hi, I'm using a NeoPixel library that inherits from the Adafruit_NeoPixel class and would like to modify the library to instead inherit from your tinyNeoPixel class. Adafruit_NeoPixel exposes some of the nitty gritty details of its inner workings by declaring some critical variables as "protected", making them available to classes that inherit from Adafruit_Neopixel.

protected:
#ifdef NEO_KHZ400 // If 400 KHz NeoPixel support enabled...
  bool is800KHz; ///< true if 800 KHz pixels
#endif
  bool begun;         ///< true if begin() previously called
  uint16_t numLEDs;   ///< Number of RGB LEDs in strip
  uint16_t numBytes;  ///< Size of 'pixels' buffer below
  int16_t pin;        ///< Output pin number (-1 if not yet set)
  uint8_t brightness; ///< Strip brightness 0-255 (stored as +1)
  uint8_t *pixels;    ///< Holds LED color values (3 or 4 bytes each)
  uint8_t rOffset;    ///< Red index within each 3- or 4-byte pixel
  uint8_t gOffset;    ///< Index of green byte
  uint8_t bOffset;    ///< Index of blue byte
  uint8_t wOffset;    ///< Index of white (==rOffset if no white)
  uint32_t endTime;   ///< Latch timing reference

Unfortunately, those variables are declared private in tinyNeoPixel, so are not reachable. Would you be willing to change the declaration to protected?

Thanks for sharing all your ATtiny hard work.