Skip to content

Commit

Permalink
added lcdGetFrameBuffer/lcdSetFrameBuffer function
Browse files Browse the repository at this point in the history
  • Loading branch information
nopnop2002 committed Jan 15, 2025
1 parent 36e7c2f commit 8f6e1a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/ili9340/ili9340.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,16 @@ void lcdResumeFrameBuffer(TFT_t * dev) {
dev->_use_frame_buffer = dev->_use_frame_buffer_evacuate;
}

// Get frame buffer
void lcdGetFrameBuffer(TFT_t * dev, uint16_t *buffer) {
memcpy((char *)buffer, (char *)dev->_frame_buffer, sizeof(uint16_t)*dev->_width*dev->_height);
}

// Set frame buffer
void lcdSetFrameBuffer(TFT_t * dev, uint16_t *buffer) {
memcpy((char *)dev->_frame_buffer, (char *)buffer, sizeof(uint16_t)*dev->_width*dev->_height);
}

// Draw pixel
// x:X coordinate
// y:Y coordinate
Expand Down
2 changes: 2 additions & 0 deletions components/ili9340/ili9340.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ void lcdWriteRegisterByte(TFT_t * dev, uint8_t addr, uint16_t data);
void lcdInit(TFT_t * dev, uint16_t model, int width, int height, int offsetx, int offsety);
void lcdDisableFrameBuffer(TFT_t * dev);
void lcdResumeFrameBuffer(TFT_t * dev);
void lcdGetFrameBuffer(TFT_t * dev, uint16_t *buffer);
void lcdSetFrameBuffer(TFT_t * dev, uint16_t *buffer);
void lcdDrawPixel(TFT_t * dev, uint16_t x, uint16_t y, uint16_t color);
void lcdDrawMultiPixels(TFT_t * dev, uint16_t x, uint16_t y, uint16_t size, uint16_t * colors);
void lcdDrawFillRect(TFT_t * dev, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
Expand Down

0 comments on commit 8f6e1a4

Please sign in to comment.