Skip to content

Commit

Permalink
[driver] Ili9241: Add drawRaw() method
Browse files Browse the repository at this point in the history
  • Loading branch information
rleh committed Apr 3, 2021
1 parent 68bd35a commit c8d6378
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modm/driver/display/ili9341.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ class Ili9341 : public Interface, public modm::GraphicDisplay
uint16_t width, uint16_t height,
modm::accessor::Flash<uint8_t> data) override;

virtual void
drawRaw(glcd::Point upperLeft, uint16_t width, uint16_t height, glcd::Color* data);

void
setScrollArea(uint16_t topFixedRows, uint16_t bottomFixedRows, uint16_t firstRow);
void
Expand Down
16 changes: 16 additions & 0 deletions src/modm/driver/display/ili9341_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,22 @@ Ili9341<Interface, Reset, Backlight, BufferSize>::drawImageRaw(glcd::Point upper
}
}

template <class Interface, class Reset, class Backlight, std::size_t BufferSize>
void
Ili9341<Interface, Reset, Backlight, BufferSize>::drawRaw(glcd::Point upperLeft,
uint16_t width, uint16_t height, glcd::Color* data)
{
BatchHandle h(*this);

uint16_t* buffer = (uint16_t*)data;
for(size_t i = 0; i < uint16_t(width*height); i++) {
buffer[i] = modm::fromBigEndian(buffer[i]);
}

setClipping(upperLeft.getX(), upperLeft.getY(), width, height);
this->writeData((uint8_t*)buffer, width * height * 2);
}

template <class Interface, class Reset, class Backlight, std::size_t BufferSize>
void
Ili9341<Interface, Reset, Backlight, BufferSize>::setScrollArea(
Expand Down

0 comments on commit c8d6378

Please sign in to comment.