Clear Buffer (#426)

This commit is contained in:
Michael Miller
2021-02-10 20:25:47 -08:00
committed by GitHub
parent 663c6492f4
commit 7a73ffc7b4
15 changed files with 20 additions and 30 deletions

View File

@@ -169,14 +169,14 @@ public:
void Begin() void Begin()
{ {
_method.Initialize(); _method.Initialize();
Dirty(); ClearTo(0);
} }
// used by DotStartSpiMethod if pins can be configured // used by DotStartSpiMethod if pins can be configured
void Begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) void Begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
{ {
_method.Initialize(sck, miso, mosi, ss); _method.Initialize(sck, miso, mosi, ss);
Dirty(); ClearTo(0);
} }
void Show(bool maintainBufferConsistency = true) void Show(bool maintainBufferConsistency = true)

View File

@@ -43,7 +43,7 @@ public:
_wire(pinClock, pinData) _wire(pinClock, pinData)
{ {
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData); // data cleared later in Begin()
} }
#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny) #if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)

View File

@@ -103,6 +103,9 @@ public:
} }
} }
typedef RgbColor ColorObject;
protected:
static void encodePixel(uint8_t c1, uint8_t c2, uint8_t c3, uint16_t* color555) static void encodePixel(uint8_t c1, uint8_t c2, uint8_t c3, uint16_t* color555)
{ {
*color555 = (0x8000 | *color555 = (0x8000 |
@@ -117,9 +120,6 @@ public:
*c2 = (color555 >> 2) & 0xf8; *c2 = (color555 >> 2) & 0xf8;
*c3 = (color555 << 3) & 0xf8; *c3 = (color555 << 3) & 0xf8;
} }
typedef RgbColor ColorObject;
}; };
class Lpd6803BrgFeature : public Lpd68033Elements class Lpd6803BrgFeature : public Lpd68033Elements

View File

@@ -43,17 +43,7 @@ public:
_wire(pinClock, pinData) _wire(pinClock, pinData)
{ {
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
// data cleared later in Begin()
// requires specific memory init
memset(_data, 0, _sizeData); // is not good enough
uint16_t* pPixel = reinterpret_cast<uint16_t*>(_data + settingsSize);
uint16_t* pPixelEnd = pPixel + (_sizeData / elementSize);
while (pPixel < pPixelEnd)
{
Lpd68033Elements::encodePixel(0, 0, 0, pPixel);
pPixel++;
}
} }
#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny) #if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)

View File

@@ -43,7 +43,7 @@ public:
_wire(pinClock, pinData) _wire(pinClock, pinData)
{ {
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData); // data cleared later in Begin()
} }
#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny) #if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)

View File

@@ -42,7 +42,7 @@ public:
pinMode(pin, OUTPUT); pinMode(pin, OUTPUT);
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData); // data cleared later in Begin()
} }
~NeoArmMethodBase() ~NeoArmMethodBase()

View File

@@ -127,7 +127,7 @@ public:
pinMode(pin, OUTPUT); pinMode(pin, OUTPUT);
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData); // data cleared later in Begin()
_port = portOutputRegister(digitalPinToPort(pin)); _port = portOutputRegister(digitalPinToPort(pin));
_pinMask = digitalPinToBitMask(pin); _pinMask = digitalPinToBitMask(pin);

View File

@@ -129,10 +129,10 @@ public:
} }
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0x00, _sizeData); // data cleared later in Begin()
_i2sBuffer = static_cast<uint8_t*>(malloc(_i2sBufferSize)); _i2sBuffer = static_cast<uint8_t*>(malloc(_i2sBufferSize));
memset(_i2sBuffer, 0x00, _i2sBufferSize); // no need to initialize it, it gets overwritten on every send
} }
~NeoEsp32I2sMethodBase() ~NeoEsp32I2sMethodBase()

View File

@@ -505,7 +505,7 @@ private:
void construct() void construct()
{ {
_dataEditing = static_cast<uint8_t*>(malloc(_sizeData)); _dataEditing = static_cast<uint8_t*>(malloc(_sizeData));
memset(_dataEditing, 0x00, _sizeData); // data cleared later in Begin()
_dataSending = static_cast<uint8_t*>(malloc(_sizeData)); _dataSending = static_cast<uint8_t*>(malloc(_sizeData));
// no need to initialize it, it gets overwritten on every send // no need to initialize it, it gets overwritten on every send

View File

@@ -226,10 +226,10 @@ public:
_i2sBufferSize = pixelCount * dmaPixelSize + dmaSettingsSize; _i2sBufferSize = pixelCount * dmaPixelSize + dmaSettingsSize;
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0x00, _sizeData); // data cleared later in Begin()
_i2sBuffer = static_cast<uint8_t*>(malloc(_i2sBufferSize)); _i2sBuffer = static_cast<uint8_t*>(malloc(_i2sBufferSize));
memset(_i2sBuffer, T_SPEED::Level, _i2sBufferSize); // no need to initialize it, it gets overwritten on every send
// _i2sBuffer[0] = 0b11101000; // debug, 1 bit then 0 bit // _i2sBuffer[0] = 0b11101000; // debug, 1 bit then 0 bit

View File

@@ -150,7 +150,7 @@ protected:
_sizeData(pixelCount * elementSize + settingsSize) _sizeData(pixelCount * elementSize + settingsSize)
{ {
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0x00, _sizeData); // data cleared later in Begin()
} }
~NeoEsp8266UartBase() ~NeoEsp8266UartBase()

View File

@@ -285,7 +285,7 @@ public:
pinMode(pin, OUTPUT); pinMode(pin, OUTPUT);
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData); // data cleared later in Begin()
} }
~NeoEspBitBangMethodBase() ~NeoEspBitBangMethodBase()

View File

@@ -348,7 +348,7 @@ private:
pinMode(_pin, OUTPUT); pinMode(_pin, OUTPUT);
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData); // data cleared later in Begin()
_dmaBufferSize = c_dmaBytesPerDataByte * _sizeData + sizeof(nrf_pwm_values_common_t); _dmaBufferSize = c_dmaBytesPerDataByte * _sizeData + sizeof(nrf_pwm_values_common_t);
_dmaBuffer = static_cast<nrf_pwm_values_common_t*>(malloc(_dmaBufferSize)); _dmaBuffer = static_cast<nrf_pwm_values_common_t*>(malloc(_dmaBufferSize));

View File

@@ -43,7 +43,7 @@ public:
_wire(pinClock, pinData) _wire(pinClock, pinData)
{ {
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData); // data cleared later in Begin()
} }
#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny) #if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)

View File

@@ -42,7 +42,7 @@ public:
_wire(pinClock, pinData) _wire(pinClock, pinData)
{ {
_data = static_cast<uint8_t*>(malloc(_sizeData)); _data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData); // data cleared later in Begin()
} }
#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny) #if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)