kopia lustrzana https://github.com/OpenRTX/OpenRTX
Removed framebuffer from Module17 display driver
rodzic
11d7a92f4e
commit
7fc16388e0
|
@ -29,20 +29,9 @@
|
|||
#include <hwconfig.h>
|
||||
#include <SPI2.h>
|
||||
|
||||
/*
|
||||
* LCD framebuffer, statically allocated and placed in the "large" RAM block
|
||||
* starting at 0x20000000.
|
||||
* Pixel format is black and white, one bit per pixel.
|
||||
*/
|
||||
#define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1)
|
||||
static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE];
|
||||
|
||||
|
||||
void display_init()
|
||||
{
|
||||
/* Clear framebuffer, setting all pixels to 0x00 makes the screen white */
|
||||
memset(frameBuffer, 0x00, FB_SIZE);
|
||||
|
||||
/*
|
||||
* Initialise SPI2 for external flash and LCD
|
||||
*/
|
||||
|
@ -103,10 +92,11 @@ void display_terminate()
|
|||
spi2_terminate();
|
||||
}
|
||||
|
||||
void display_renderRows(uint8_t startRow, uint8_t endRow)
|
||||
void display_renderRows(uint8_t startRow, uint8_t endRow, void *fb)
|
||||
{
|
||||
gpio_clearPin(LCD_CS);
|
||||
|
||||
uint8_t *frameBuffer = (uint8_t *) fb;
|
||||
for(uint8_t y = startRow; y < endRow; y++)
|
||||
{
|
||||
for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH/8; x++)
|
||||
|
@ -125,14 +115,9 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
|
|||
gpio_setPin(LCD_CS);
|
||||
}
|
||||
|
||||
void display_render()
|
||||
void display_render(void *fb)
|
||||
{
|
||||
display_renderRows(0, CONFIG_SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
void *display_getFrameBuffer()
|
||||
{
|
||||
return (void *)(frameBuffer);
|
||||
display_renderRows(0, CONFIG_SCREEN_HEIGHT, fb);
|
||||
}
|
||||
|
||||
void display_setContrast(uint8_t contrast)
|
||||
|
|
|
@ -30,14 +30,6 @@
|
|||
#include <SPI2.h>
|
||||
|
||||
|
||||
/*
|
||||
* LCD framebuffer, statically allocated and placed in the "large" RAM block
|
||||
* starting at 0x20000000.
|
||||
* Pixel format is black and white, one bit per pixel.
|
||||
*/
|
||||
#define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1)
|
||||
static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE];
|
||||
|
||||
/**
|
||||
* \internal
|
||||
* Send one row of pixels to the display.
|
||||
|
@ -46,7 +38,7 @@ static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE];
|
|||
*
|
||||
* @param row: pixel row to be be sent.
|
||||
*/
|
||||
void display_renderRow(uint8_t row)
|
||||
void display_renderRow(uint8_t row, uint8_t *frameBuffer)
|
||||
{
|
||||
for(uint16_t i = 0; i < 64; i++)
|
||||
{
|
||||
|
@ -65,9 +57,6 @@ void display_renderRow(uint8_t row)
|
|||
|
||||
void display_init()
|
||||
{
|
||||
/* Clear framebuffer, setting all pixels to 0x00 makes the screen white */
|
||||
memset(frameBuffer, 0x00, FB_SIZE);
|
||||
|
||||
/*
|
||||
* Initialise SPI2 for external flash and LCD
|
||||
*/
|
||||
|
@ -128,7 +117,7 @@ void display_terminate()
|
|||
spi2_terminate();
|
||||
}
|
||||
|
||||
void display_renderRows(uint8_t startRow, uint8_t endRow)
|
||||
void display_renderRows(uint8_t startRow, uint8_t endRow, void *fb)
|
||||
{
|
||||
gpio_clearPin(LCD_CS);
|
||||
|
||||
|
@ -139,20 +128,15 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
|
|||
(void) spi2_sendRecv(0x00); /* Set X position */
|
||||
(void) spi2_sendRecv(0x10);
|
||||
gpio_setPin(LCD_RS); /* RS high -> data mode */
|
||||
display_renderRow(row);
|
||||
display_renderRow(row, (uint8_t *) fb);
|
||||
}
|
||||
|
||||
gpio_setPin(LCD_CS);
|
||||
}
|
||||
|
||||
void display_render()
|
||||
void display_render(void *fb)
|
||||
{
|
||||
display_renderRows(0, (CONFIG_SCREEN_WIDTH / 8) - 1);
|
||||
}
|
||||
|
||||
void *display_getFrameBuffer()
|
||||
{
|
||||
return (void *)(frameBuffer);
|
||||
display_renderRows(0, (CONFIG_SCREEN_WIDTH / 8) - 1, fb);
|
||||
}
|
||||
|
||||
void display_setContrast(uint8_t contrast)
|
||||
|
|
|
@ -163,10 +163,18 @@ SECTIONS
|
|||
} > smallram AT > flash
|
||||
_etext = LOADADDR(.data);
|
||||
|
||||
/* Put the display framebuffer in the "large" RAM, explicitly request to not
|
||||
initialize it */
|
||||
.bss2 (NOLOAD) :
|
||||
{
|
||||
*(.bss.fb)
|
||||
. = ALIGN(8);
|
||||
} > largeram
|
||||
|
||||
/* .bss section: uninitialized global variables go to ram */
|
||||
_bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
_bss_start = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
|
@ -174,14 +182,6 @@ SECTIONS
|
|||
} > smallram
|
||||
_bss_end = .;
|
||||
|
||||
/* Second BSS section located in the "large" RAM, explicitly request to not
|
||||
initialize it */
|
||||
.bss2 (NOLOAD) :
|
||||
{
|
||||
*(.bss2)
|
||||
. = ALIGN(8);
|
||||
} > largeram
|
||||
|
||||
_end = .;
|
||||
PROVIDE(end = .);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue