Skip to content

Commit

Permalink
remove tabs (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
Makuna authored Sep 20, 2020
1 parent c7b0c66 commit 0c41010
Show file tree
Hide file tree
Showing 17 changed files with 577 additions and 577 deletions.
58 changes: 29 additions & 29 deletions src/internal/DotStarGenericMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ License along with NeoPixel. If not, see
template<typename T_TWOWIRE> class DotStarMethodBase
{
public:
DotStarMethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
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)
_wire(pinClock, pinData)
_sizeEndFrame((pixelCount + 15) / 16), // 16 = div 2 (bit for every two pixels) div 8 (bits to bytes)
_wire(pinClock, pinData)
{
_data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData);
}

#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)
DotStarMethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
DotStarMethodBase(SCK, MOSI, pixelCount, elementSize, settingsSize)
{
}
DotStarMethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
DotStarMethodBase(SCK, MOSI, pixelCount, elementSize, settingsSize)
{
}
#endif

~DotStarMethodBase()
Expand All @@ -64,42 +64,42 @@ template<typename T_TWOWIRE> class DotStarMethodBase
}

#if defined(ARDUINO_ARCH_ESP32)
void Initialize(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
{
_wire.begin(sck, miso, mosi, ss);
}
void Initialize(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
{
_wire.begin(sck, miso, mosi, ss);
}
#endif

void Initialize()
{
_wire.begin();
_wire.begin();
}

void Update(bool)
{
const uint8_t startFrame[4] = { 0x00 };
const uint8_t resetFrame[4] = { 0x00 };
_wire.beginTransaction();
const uint8_t startFrame[4] = { 0x00 };
const uint8_t resetFrame[4] = { 0x00 };
_wire.beginTransaction();

// start frame
_wire.transmitBytes(startFrame, sizeof(startFrame));
_wire.transmitBytes(startFrame, sizeof(startFrame));

// data
_wire.transmitBytes(_data, _sizeData);
_wire.transmitBytes(_data, _sizeData);

// reset frame
_wire.transmitBytes(resetFrame, sizeof(resetFrame));
_wire.transmitBytes(resetFrame, sizeof(resetFrame));

// end frame

// one bit for every two pixels with no less than 1 byte
for (size_t endFrameByte = 0; endFrameByte < _sizeEndFrame; endFrameByte++)
{
_wire.transmitByte(0x00);
}
_wire.endTransaction();
// one bit for every two pixels with no less than 1 byte
for (size_t endFrameByte = 0; endFrameByte < _sizeEndFrame; endFrameByte++)
{
_wire.transmitByte(0x00);
}
_wire.endTransaction();
}

uint8_t* getData() const
Expand All @@ -113,10 +113,10 @@ template<typename T_TWOWIRE> class DotStarMethodBase
};

private:
const size_t _sizeData; // Size of '_data' buffer below
const size_t _sizeEndFrame;
const size_t _sizeData; // Size of '_data' buffer below
const size_t _sizeEndFrame;

T_TWOWIRE _wire;
T_TWOWIRE _wire;
uint8_t* _data; // Holds LED color values
};

Expand Down
64 changes: 32 additions & 32 deletions src/internal/Lpd8806ColorFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,38 +114,38 @@ class Lpd88063Elements : public Lpd88063ElementsNoSettings
class Lpd8806BrgFeature : public Lpd88063Elements
{
public:
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint8_t* p = getPixelAddress(pPixels, indexPixel);

*p++ = (color.B >> 1) | 0x80;
*p++ = (color.R >> 1) | 0x80;
*p = (color.G >> 1) | 0x80;
}

static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
const uint8_t* p = getPixelAddress(pPixels, indexPixel);

color.B = (*p++) << 1;
color.R = (*p++) << 1;
color.G = (*p) << 1;

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);

color.B = (pgm_read_byte(p++)) << 1;
color.R = (pgm_read_byte(p++)) << 1;
color.G = (pgm_read_byte(p)) << 1;

return color;
}
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint8_t* p = getPixelAddress(pPixels, indexPixel);

*p++ = (color.B >> 1) | 0x80;
*p++ = (color.R >> 1) | 0x80;
*p = (color.G >> 1) | 0x80;
}

static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
const uint8_t* p = getPixelAddress(pPixels, indexPixel);

color.B = (*p++) << 1;
color.R = (*p++) << 1;
color.G = (*p) << 1;

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);

color.B = (pgm_read_byte(p++)) << 1;
color.R = (pgm_read_byte(p++)) << 1;
color.G = (pgm_read_byte(p)) << 1;

return color;
}

};

Expand Down
54 changes: 27 additions & 27 deletions src/internal/Lpd8806GenericMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ License along with NeoPixel. If not, see
template<typename T_TWOWIRE> class Lpd8806MethodBase
{
public:
Lpd8806MethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
Lpd8806MethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
_sizeData(pixelCount * elementSize + settingsSize),
_sizeFrame((pixelCount + 31) / 32),
_wire(pinClock, pinData)
_sizeFrame((pixelCount + 31) / 32),
_wire(pinClock, pinData)
{
_data = static_cast<uint8_t*>(malloc(_sizeData));
memset(_data, 0, _sizeData);
}

#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)
Lpd8806MethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
Lpd8806MethodBase(SCK, MOSI, pixelCount, elementSize, settingsSize)
{
}
Lpd8806MethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
Lpd8806MethodBase(SCK, MOSI, pixelCount, elementSize, settingsSize)
{
}
#endif


Expand All @@ -65,37 +65,37 @@ template<typename T_TWOWIRE> class Lpd8806MethodBase
}

#if defined(ARDUINO_ARCH_ESP32)
void Initialize(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
{
_wire.begin(sck, miso, mosi, ss);
}
void Initialize(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
{
_wire.begin(sck, miso, mosi, ss);
}
#endif

void Initialize()
{
_wire.begin();
_wire.begin();
}

void Update(bool)
{
_wire.beginTransaction();
_wire.beginTransaction();

// start frame
for (size_t frameByte = 0; frameByte < _sizeFrame; frameByte++)
{
_wire.transmitByte(0x00);
}
for (size_t frameByte = 0; frameByte < _sizeFrame; frameByte++)
{
_wire.transmitByte(0x00);
}

// data
_wire.transmitBytes(_data, _sizeData);
_wire.transmitBytes(_data, _sizeData);

// end frame
for (size_t frameByte = 0; frameByte < _sizeFrame; frameByte++)
{
_wire.transmitByte(0xff);
}
_wire.endTransaction();
for (size_t frameByte = 0; frameByte < _sizeFrame; frameByte++)
{
_wire.transmitByte(0xff);
}
_wire.endTransaction();
}

uint8_t* getData() const
Expand All @@ -109,10 +109,10 @@ template<typename T_TWOWIRE> class Lpd8806MethodBase
};

private:
const size_t _sizeData; // Size of '_data' buffer below
const size_t _sizeFrame;
const size_t _sizeData; // Size of '_data' buffer below
const size_t _sizeFrame;

T_TWOWIRE _wire;
T_TWOWIRE _wire;
uint8_t* _data; // Holds LED color values
};

Expand Down
34 changes: 17 additions & 17 deletions src/internal/NeoArmMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ class NeoArmMk20dxSpeedProps400Kbps
class NeoArmMk20dxSpeedPropsApa106
{
public:
static const uint32_t CyclesT0h = (F_CPU / 4000000);
static const uint32_t CyclesT1h = (F_CPU / 913750);
static const uint32_t Cycles = (F_CPU / 584800);
static const uint32_t ResetTimeUs = 50;
static const uint32_t CyclesT0h = (F_CPU / 4000000);
static const uint32_t CyclesT1h = (F_CPU / 913750);
static const uint32_t Cycles = (F_CPU / 584800);
static const uint32_t ResetTimeUs = 50;
};

template<typename T_SPEEDPROPS> class NeoArmMk20dxSpeedBase
Expand Down Expand Up @@ -591,32 +591,32 @@ template<typename T_SPEEDPROPS> class NeoArmStm32SpeedBase
uint8_t bitMask = 0x80;

#if defined(ARDUINO_STM32_FEATHER)
uint32_t pinMask = BIT(PIN_MAP[pin].gpio_bit);
uint32_t pinMask = BIT(PIN_MAP[pin].gpio_bit);

volatile uint16_t* set = &(PIN_MAP[pin].gpio_device->regs->BSRRL);
volatile uint16_t* clr = &(PIN_MAP[pin].gpio_device->regs->BSRRH);
volatile uint16_t* set = &(PIN_MAP[pin].gpio_device->regs->BSRRL);
volatile uint16_t* clr = &(PIN_MAP[pin].gpio_device->regs->BSRRH);

#elif defined(ARDUINO_ARCH_STM32F4)
uint32_t pinMask = BIT(pin & 0x0f);
uint32_t pinMask = BIT(pin & 0x0f);

volatile uint16_t* set = &(PIN_MAP[pin].gpio_device->regs->BSRRL);
volatile uint16_t* clr = &(PIN_MAP[pin].gpio_device->regs->BSRRH);
volatile uint16_t* set = &(PIN_MAP[pin].gpio_device->regs->BSRRL);
volatile uint16_t* clr = &(PIN_MAP[pin].gpio_device->regs->BSRRH);

#elif defined(ARDUINO_ARCH_STM32F1)

uint32_t pinMask = BIT(PIN_MAP[pin].gpio_bit);
uint32_t pinMask = BIT(PIN_MAP[pin].gpio_bit);

volatile uint32_t* set = &(PIN_MAP[pin].gpio_device->regs->BRR);
volatile uint32_t* clr = &(PIN_MAP[pin].gpio_device->regs->BSRR);
volatile uint32_t* set = &(PIN_MAP[pin].gpio_device->regs->BRR);
volatile uint32_t* clr = &(PIN_MAP[pin].gpio_device->regs->BSRR);

#elif defined(ARDUINO_ARCH_STM32L4)

uint32_t pinMask = g_APinDescription[pin].bit;
uint32_t pinMask = g_APinDescription[pin].bit;

GPIO_TypeDef* GPIO = static_cast<GPIO_TypeDef*>(g_APinDescription[pin].GPIO);
GPIO_TypeDef* GPIO = static_cast<GPIO_TypeDef*>(g_APinDescription[pin].GPIO);

volatile uint32_t* set = &(GPIO->BRR);
volatile uint32_t* clr = &(GPIO->BSRR);
volatile uint32_t* set = &(GPIO->BRR);
volatile uint32_t* clr = &(GPIO->BSRR);

#endif
for (;;)
Expand Down
2 changes: 1 addition & 1 deletion src/internal/NeoBitmapFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ template<typename T_COLOR_FEATURE, typename T_FILE_METHOD> class NeoBitmapFile
int16_t hSrc,
LayoutMapCallback layoutMap)
{
NeoShaderNop<typename T_COLOR_FEATURE::ColorObject> shaderNop;
NeoShaderNop<typename T_COLOR_FEATURE::ColorObject> shaderNop;

Render<NeoShaderNop<typename T_COLOR_FEATURE::ColorObject>>(destBuffer,
shaderNop,
Expand Down
Loading

0 comments on commit 0c41010

Please sign in to comment.