Skip to content

Commit

Permalink
DotStarEsp32DmaSpiMethod: adjust start+end frames to reflect bus width (
Browse files Browse the repository at this point in the history
  • Loading branch information
peragwin authored Feb 10, 2023
1 parent bcab173 commit 7e38508
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/internal/DotStarEsp32DmaSpiMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ template<typename T_SPISPEED, typename T_SPIBUS> class _DotStarEsp32DmaSpiMethod
typedef typename T_SPISPEED::SettingsObject SettingsObject;

_DotStarEsp32DmaSpiMethod(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
_sizeStartFrame(4 * T_SPIBUS::ParallelBits),
_sizePixelData(pixelCount * elementSize + settingsSize),
_sizeEndFrame((pixelCount + 15) / 16) // 16 = div 2 (bit for every two pixels) div 8 (bits to bytes)
_sizeEndFrame((pixelCount + 15) / 16 * T_SPIBUS::ParallelBits) // 16 = div 2 (bit for every two pixels) div 8 (bits to bytes)
{
_spiBufferSize = _sizeStartFrame + _sizePixelData + _sizeEndFrame;

Expand Down Expand Up @@ -235,7 +236,7 @@ template<typename T_SPISPEED, typename T_SPIBUS> class _DotStarEsp32DmaSpiMethod
ESP_ERROR_CHECK(ret);
}

const size_t _sizeStartFrame = 4;
const size_t _sizeStartFrame;
const size_t _sizePixelData; // Size of '_data' buffer below, minus (_sizeStartFrame + _sizeEndFrame)
const size_t _sizeEndFrame;

Expand Down

0 comments on commit 7e38508

Please sign in to comment.