Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Commit

Permalink
[ui] Refactor buffer to display_buffer in BufferedGraphicDisplay.
Browse files Browse the repository at this point in the history
  • Loading branch information
strongly-typed authored and salkinium committed Mar 24, 2017
1 parent 52b9464 commit e1efaf4
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/xpcc/driver/display/ks0108_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ xpcc::Ks0108<E, RW, RS, PIN_CS1, PIN_CS2, PORT>::update()
{
this->selectLeftChip();
this->waitBusy();
this->writeData(this->buffer[i][page]);
this->writeData(this->display_buffer[i][page]);

this->selectRightChip();
this->waitBusy();
this->writeData(this->buffer[i + 64][page]);
this->writeData(this->display_buffer[i + 64][page]);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/xpcc/driver/display/max7219matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ xpcc::Max7219matrix< SPI, CS, COLUMNS, ROWS >::update()
// a group of eight pixels vertical
for (uint8_t row = 0; row < ROWS; ++row)
{
buf[idx] = this->buffer[col * 8 + ledCol][row];
buf[idx] = this->display_buffer[col * 8 + ledCol][row];
++idx;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/xpcc/driver/display/nokia5110_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Nokia5110< Spi, Ce, Dc, Reset >::update()
Dc::set(); // high = data
for (uint8_t xx = 0; xx < this->getWidth(); ++xx) {
for (uint8_t yy = 0; yy < this->getHeight() / 8; ++yy) {
Spi::transferBlocking(this->buffer[xx][yy]);
Spi::transferBlocking(this->display_buffer[xx][yy]);
}
}
Ce::set();
Expand Down
2 changes: 1 addition & 1 deletion src/xpcc/driver/display/nokia6610_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ xpcc::Nokia6610<SPI, CS, Reset, GE12>::update() {
for(uint8_t x = 0; x < this->getWidth(); ++x)
{
for(uint8_t y = 0; y < this->getHeight()/8; ++y) {
uint8_t group = this->buffer[x][y];
uint8_t group = this->display_buffer[x][y];
for (uint8_t pix = 0; pix < 8; pix+=2, group>>=2){
uint32_t data =
((group&1)?mask1Filled:mask1Blank)|
Expand Down
2 changes: 1 addition & 1 deletion src/xpcc/driver/display/siemens_m55_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ xpcc::SiemensM55<SPI, CS, RS, Reset>::update() {
for (uint8_t x = 0; x < 101; ++x)
{
// group of 8 black-and-white pixels
uint8_t group = this->buffer[x][y/8];
uint8_t group = this->display_buffer[x][y/8];

if (group & (1 << (y % 8)))
{
Expand Down
8 changes: 4 additions & 4 deletions src/xpcc/driver/display/siemens_s65_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ xpcc::SiemensS65Portrait<SPI, CS, RS, Reset>::update() {
for (uint8_t y = 0; y < height; ++y)
{
// group of 8 black-and-white pixels
uint8_t group = this->buffer[x][y];
uint8_t group = this->display_buffer[x][y];

// 8 pixels of 16 bits fit in the Tx FIFO if it is empty.
while (!(LPC_SSP0->SR & SPI_SRn_TFE));
Expand Down Expand Up @@ -277,7 +277,7 @@ xpcc::SiemensS65Portrait<SPI, CS, RS, Reset>::update() {
for (uint8_t y = 0; y < height; ++y)
{
// group of 8 black-and-white pixels
uint8_t group = this->buffer[x][y];
uint8_t group = this->display_buffer[x][y];
uint8_t spiBuffer[16];
uint8_t spiIdx = 0;

Expand Down Expand Up @@ -335,7 +335,7 @@ xpcc::SiemensS65Landscape<SPI, CS, RS, Reset>::update() {
for (uint8_t y = 0; y < height; ++y)
{
// group of 8 black-and-white pixels
uint8_t group = this->buffer[x][y];
uint8_t group = this->display_buffer[x][y];

// 8 pixels of 16 bits fit in the Tx FIFO if it is empty.
while (!(LPC_SSP0->SR & SPI_SRn_TFE));
Expand Down Expand Up @@ -367,7 +367,7 @@ xpcc::SiemensS65Landscape<SPI, CS, RS, Reset>::update() {
for (uint8_t y = 0; y < height; ++y)
{
// group of 8 black-and-white pixels
uint8_t group = this->buffer[x][y];
uint8_t group = this->display_buffer[x][y];

uint8_t spiBuffer[16];
uint8_t bufSize = 16;
Expand Down
2 changes: 1 addition & 1 deletion src/xpcc/driver/display/siemens_s75_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ xpcc::SiemensS75Common<MEMORY, RESET, WIDTH, HEIGHT, ORIENTATION>::update()
for (int_fast16_t y = 0; y < height; ++y)
{
// group of 8 black-and-white pixels
uint_fast8_t group = this->buffer[x][y];
uint_fast8_t group = this->display_buffer[x][y];
uint16_t PortBuffer[8];
uint_fast8_t PortIdx = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/xpcc/driver/display/ssd1306_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ xpcc::Ssd1306<I2cMaster>::startWriteDisplay()
{
RF_BEGIN();

RF_WAIT_UNTIL( this->transaction.configureDisplayWrite(buffer, 1024) and this->startTransaction() );
RF_WAIT_UNTIL( this->transaction.configureDisplayWrite(this->display_buffer, 512) and this->startTransaction() );

RF_END();
}
Expand Down
2 changes: 1 addition & 1 deletion src/xpcc/driver/display/st7565_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ xpcc::St7565<SPI, CS, A0, Reset, Width, Height, TopView>::update()
// switch to data mode
a0.set();
for(uint8_t x = 0; x < Width; ++x) {
spi.transferBlocking(this->buffer[x][y]);
spi.transferBlocking(this->display_buffer[x][y]);
}
}
cs.set();
Expand Down
2 changes: 1 addition & 1 deletion src/xpcc/ui/display/buffered_graphic_display.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace xpcc
virtual bool
getPixel(int16_t x, int16_t y);

uint8_t buffer[Width][Height / 8];
uint8_t display_buffer[Width][Height / 8];
};
}

Expand Down
14 changes: 7 additions & 7 deletions src/xpcc/ui/display/buffered_graphic_display_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ xpcc::BufferedGraphicDisplay<Width, Height>::clear()
{
for (uint_fast16_t y = 0; y < Height / 8; ++y) {
for (uint_fast16_t x = 0; x < Width; ++x) {
this->buffer[x][y] = 0;
this->display_buffer[x][y] = 0;
}
}

Expand All @@ -61,15 +61,15 @@ xpcc::BufferedGraphicDisplay<Width, Height>::drawHorizontalLine(
const uint8_t mask = 1 << (start.getY() & 0x07);
for (uint_fast16_t x = start.getX(); x < static_cast<uint16_t>(start.getX() + length); ++x) {
if( x < Width && y < Height ) {
this->buffer[x][y] |= mask;
this->display_buffer[x][y] |= mask;
}
}
}
else {
const uint8_t mask = ~(1 << (start.getY() & 0x07));
for (uint_fast16_t x = start.getX(); x < static_cast<uint16_t>(start.getX() + length); ++x) {
if( x < Width && y < Height ) {
this->buffer[x][y] &= mask;
this->display_buffer[x][y] &= mask;
}
}
}
Expand Down Expand Up @@ -97,7 +97,7 @@ xpcc::BufferedGraphicDisplay<Width, Height>::drawImageRaw(glcd::Point upperLeft,
uint16_t y = k + row;

if( x < Width && y < Height ) {
this->buffer[x][y] = data[i + k * width];
this->display_buffer[x][y] = data[i + k * width];
}
}
}
Expand All @@ -114,7 +114,7 @@ void
xpcc::BufferedGraphicDisplay<Width, Height>::setPixel(int16_t x, int16_t y)
{
if (static_cast<uint16_t>(x) < Width && static_cast<uint16_t>(y) < Height) {
this->buffer[x][y / 8] |= (1 << (y & 0x07));
this->display_buffer[x][y / 8] |= (1 << (y & 0x07));
}
}

Expand All @@ -123,7 +123,7 @@ void
xpcc::BufferedGraphicDisplay<Width, Height>::clearPixel(int16_t x, int16_t y)
{
if (static_cast<uint16_t>(x) < Width && static_cast<uint16_t>(y) < Height) {
this->buffer[x][y / 8] &= ~(1 << (y & 0x07));
this->display_buffer[x][y / 8] &= ~(1 << (y & 0x07));
}
}

Expand All @@ -132,7 +132,7 @@ bool
xpcc::BufferedGraphicDisplay<Width, Height>::getPixel(int16_t x, int16_t y)
{
if (static_cast<uint16_t>(x) < Width && static_cast<uint16_t>(y) < Height) {
return (this->buffer[x][y / 8] & (1 << (y & 0x07)));
return (this->display_buffer[x][y / 8] & (1 << (y & 0x07)));
}
else {
return false;
Expand Down

0 comments on commit e1efaf4

Please sign in to comment.