More Speeds and Color Order (#423)

This commit is contained in:
Michael Miller
2021-02-10 13:36:05 -08:00
committed by GitHub
parent 923b0e2312
commit d07f7aa0ab
8 changed files with 77 additions and 0 deletions
+3
View File
@@ -128,6 +128,9 @@ typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed40Mhz>> DotStarSpi40MhzMethod;
typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed20Mhz>> DotStarSpi20MhzMethod;
typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed10Mhz>> DotStarSpi10MhzMethod;
typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed2Mhz>> DotStarSpi2MhzMethod;
typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed1Mhz>> DotStarSpi1MhzMethod;
typedef DotStarMethodBase<TwoWireSpiImple<SpiSpeed500Khz>> DotStarSpi500KhzMethod;
typedef DotStarSpi10MhzMethod DotStarSpiMethod;
#endif
+42
View File
@@ -211,5 +211,47 @@ public:
}
};
class Lpd6803GbrFeature : public Lpd68033Elements
{
public:
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint8_t* p = getPixelAddress(pPixels, indexPixel);
uint16_t color555;
encodePixel(color.G, color.B, color.R, &color555);
*p++ = color555 >> 8;
*p = color555 & 0xff;
}
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
uint16_t color555;
color555 = ((*p++) << 8);
color555 |= (*p);
decodePixel(color555, &color.G, &color.B, &color.R);
return color;
}
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
{
ColorObject color;
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
uint16_t color555;
color555 = (pgm_read_byte(p++) << 8);
color555 |= pgm_read_byte(p);
decodePixel(color555, &color.G, &color.B, &color.R);
return color;
}
};
+2
View File
@@ -123,6 +123,8 @@ typedef Lpd6803MethodBase<TwoWireBitBangImple> Lpd6803Method;
typedef Lpd6803MethodBase<TwoWireSpiImple<SpiSpeed20Mhz>> Lpd6803Spi20MhzMethod;
typedef Lpd6803MethodBase<TwoWireSpiImple<SpiSpeed10Mhz>> Lpd6803Spi10MhzMethod;
typedef Lpd6803MethodBase<TwoWireSpiImple<SpiSpeed2Mhz>> Lpd6803Spi2MhzMethod;
typedef Lpd6803MethodBase<TwoWireSpiImple<SpiSpeed1Mhz>> Lpd6803Spi1MhzMethod;
typedef Lpd6803MethodBase<TwoWireSpiImple<SpiSpeed500Khz>> Lpd6803Spi500KhzMethod;
typedef Lpd6803Spi10MhzMethod Lpd6803SpiMethod;
#endif
+2
View File
@@ -123,6 +123,8 @@ typedef Lpd8806MethodBase<TwoWireBitBangImple> Lpd8806Method;
typedef Lpd8806MethodBase<TwoWireSpiImple<SpiSpeed20Mhz>> Lpd8806Spi20MhzMethod;
typedef Lpd8806MethodBase<TwoWireSpiImple<SpiSpeed10Mhz>> Lpd8806Spi10MhzMethod;
typedef Lpd8806MethodBase<TwoWireSpiImple<SpiSpeed2Mhz>> Lpd8806Spi2MhzMethod;
typedef Lpd8806MethodBase<TwoWireSpiImple<SpiSpeed1Mhz>> Lpd8806Spi1MhzMethod;
typedef Lpd8806MethodBase<TwoWireSpiImple<SpiSpeed500Khz>> Lpd8806Spi500KhzMethod;
typedef Lpd8806Spi10MhzMethod Lpd8806SpiMethod;
#endif
+3
View File
@@ -119,6 +119,9 @@ typedef P9813MethodBase<TwoWireBitBangImple> P9813Method;
typedef P9813MethodBase<TwoWireSpiImple<SpiSpeed20Mhz>> P9813Spi20MhzMethod;
typedef P9813MethodBase<TwoWireSpiImple<SpiSpeed10Mhz>> P9813Spi10MhzMethod;
typedef P9813MethodBase<TwoWireSpiImple<SpiSpeed2Mhz>> P9813Spi2MhzMethod;
typedef P9813MethodBase<TwoWireSpiImple<SpiSpeed1Mhz>> P9813Spi1MhzMethod;
typedef P9813MethodBase<TwoWireSpiImple<SpiSpeed500Khz>> P9813Spi500KhzMethod;
typedef P9813Spi10MhzMethod P9813SpiMethod;
#endif
+12
View File
@@ -52,6 +52,18 @@ public:
static const uint32_t Clock = 2000000L;
};
class SpiSpeed1Mhz
{
public:
static const uint32_t Clock = 1000000L;
};
class SpiSpeed500Khz
{
public:
static const uint32_t Clock = 500000L;
};
template<typename T_SPISPEED> class TwoWireSpiImple
{
public:
+2
View File
@@ -125,6 +125,8 @@ typedef Ws2801MethodBase<TwoWireBitBangImple> NeoWs2801Method;
typedef Ws2801MethodBase<TwoWireSpiImple<SpiSpeed20Mhz>> NeoWs2801Spi20MhzMethod;
typedef Ws2801MethodBase<TwoWireSpiImple<SpiSpeed10Mhz>> NeoWs2801Spi10MhzMethod;
typedef Ws2801MethodBase<TwoWireSpiImple<SpiSpeed2Mhz>> NeoWs2801Spi2MhzMethod;
typedef Ws2801MethodBase<TwoWireSpiImple<SpiSpeed1Mhz>> NeoWs2801Spi1MhzMethod;
typedef Ws2801MethodBase<TwoWireSpiImple<SpiSpeed500Khz>> NeoWs2801Spi500KhzMethod;
typedef NeoWs2801Spi10MhzMethod NeoWs2801SpiMethod;
#endif