adafruit / Adafruit_DotStar

GNU General Public License v3.0
98 stars 58 forks source link

Move definition of USE_HW_SPI to header file #12

Closed jbash closed 7 years ago

jbash commented 7 years ago

This just moves the definition of USE_HW_SPI from the implementation to the header file, so that code that calls the library can use a symbolic value instead of the magic number 255. I guess it might generate warnings in code that redefines the constant for its own use; I'm not sure how (or if) you set warning options in this Arduino business. I can't see how it would actually make any working code malfunction.

Abstraction is good.

yngndrw commented 7 years ago

I don't believe this is needed. The USE_HW_SPI flag is an internal detail as you're meant to enable hardware mode with a separate constructor overload: https://github.com/adafruit/Adafruit_DotStar/blob/master/Adafruit_DotStar.cpp#L35

There's also a way of enabling hardware mode after initial instantiation: https://github.com/adafruit/Adafruit_DotStar/blob/master/Adafruit_DotStar.cpp#L69

jbash commented 7 years ago

OK.