Spi dynamic speed (#432)

This commit is contained in:
Michael Miller authored and GitHub committed 2021-02-16 10:23:02 -08:00
1 parent b76a42bb5a
commit 816de24962
19 files changed
+174 -1

No files matched your search

+9
View File
@@ -37,6 +37,8 @@ License along with NeoPixel. If not, see
template<typename T_TWOWIRE> class DotStarMethodBase
{
public:
typedef typename T_TWOWIRE::SettingsObject SettingsObject;
DotStarMethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
_sizeData(pixelCount * elementSize + settingsSize),
_sizeEndFrame((pixelCount + 15) / 16), // 16 = div 2 (bit for every two pixels) div 8 (bits to bytes)
@@ -112,6 +114,11 @@ public:
return _sizeData;
};
void applySettings(const SettingsObject& settings)
{
_wire.applySettings(settings);
}
private:
const size_t _sizeData; // Size of '_data' buffer below
const size_t _sizeEndFrame;
@@ -131,6 +138,8 @@ typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed2Mhz>> DotStarSpi2MhzMethod;
typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed1Mhz>> DotStarSpi1MhzMethod;
typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed500Khz>> DotStarSpi500KhzMethod;
typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeedHz>> DotStarSpiHzMethod;
typedef DotStarSpi10MhzMethod DotStarSpiMethod;
#endif