Removed framebuffer from Module17 display driver
This commit is contained in:
parent
11d7a92f4e
commit
7fc16388e0
|
|
@ -29,20 +29,9 @@
|
||||||
#include <hwconfig.h>
|
#include <hwconfig.h>
|
||||||
#include <SPI2.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()
|
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
|
* Initialise SPI2 for external flash and LCD
|
||||||
*/
|
*/
|
||||||
|
|
@ -103,10 +92,11 @@ void display_terminate()
|
||||||
spi2_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);
|
gpio_clearPin(LCD_CS);
|
||||||
|
|
||||||
|
uint8_t *frameBuffer = (uint8_t *) fb;
|
||||||
for(uint8_t y = startRow; y < endRow; y++)
|
for(uint8_t y = startRow; y < endRow; y++)
|
||||||
{
|
{
|
||||||
for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH/8; x++)
|
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);
|
gpio_setPin(LCD_CS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_render()
|
void display_render(void *fb)
|
||||||
{
|
{
|
||||||
display_renderRows(0, CONFIG_SCREEN_HEIGHT);
|
display_renderRows(0, CONFIG_SCREEN_HEIGHT, fb);
|
||||||
}
|
|
||||||
|
|
||||||
void *display_getFrameBuffer()
|
|
||||||
{
|
|
||||||
return (void *)(frameBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_setContrast(uint8_t contrast)
|
void display_setContrast(uint8_t contrast)
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,6 @@
|
||||||
#include <SPI2.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];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \internal
|
* \internal
|
||||||
* Send one row of pixels to the display.
|
* 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.
|
* @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++)
|
for(uint16_t i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -65,9 +57,6 @@ void display_renderRow(uint8_t row)
|
||||||
|
|
||||||
void display_init()
|
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
|
* Initialise SPI2 for external flash and LCD
|
||||||
*/
|
*/
|
||||||
|
|
@ -128,7 +117,7 @@ void display_terminate()
|
||||||
spi2_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);
|
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(0x00); /* Set X position */
|
||||||
(void) spi2_sendRecv(0x10);
|
(void) spi2_sendRecv(0x10);
|
||||||
gpio_setPin(LCD_RS); /* RS high -> data mode */
|
gpio_setPin(LCD_RS); /* RS high -> data mode */
|
||||||
display_renderRow(row);
|
display_renderRow(row, (uint8_t *) fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpio_setPin(LCD_CS);
|
gpio_setPin(LCD_CS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_render()
|
void display_render(void *fb)
|
||||||
{
|
{
|
||||||
display_renderRows(0, (CONFIG_SCREEN_WIDTH / 8) - 1);
|
display_renderRows(0, (CONFIG_SCREEN_WIDTH / 8) - 1, fb);
|
||||||
}
|
|
||||||
|
|
||||||
void *display_getFrameBuffer()
|
|
||||||
{
|
|
||||||
return (void *)(frameBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_setContrast(uint8_t contrast)
|
void display_setContrast(uint8_t contrast)
|
||||||
|
|
|
||||||
|
|
@ -163,10 +163,18 @@ SECTIONS
|
||||||
} > smallram AT > flash
|
} > smallram AT > flash
|
||||||
_etext = LOADADDR(.data);
|
_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 section: uninitialized global variables go to ram */
|
||||||
_bss_start = .;
|
|
||||||
.bss :
|
.bss :
|
||||||
{
|
{
|
||||||
|
_bss_start = .;
|
||||||
*(.bss)
|
*(.bss)
|
||||||
*(.bss.*)
|
*(.bss.*)
|
||||||
*(.gnu.linkonce.b.*)
|
*(.gnu.linkonce.b.*)
|
||||||
|
|
@ -174,14 +182,6 @@ SECTIONS
|
||||||
} > smallram
|
} > smallram
|
||||||
_bss_end = .;
|
_bss_end = .;
|
||||||
|
|
||||||
/* Second BSS section located in the "large" RAM, explicitly request to not
|
|
||||||
initialize it */
|
|
||||||
.bss2 (NOLOAD) :
|
|
||||||
{
|
|
||||||
*(.bss2)
|
|
||||||
. = ALIGN(8);
|
|
||||||
} > largeram
|
|
||||||
|
|
||||||
_end = .;
|
_end = .;
|
||||||
PROVIDE(end = .);
|
PROVIDE(end = .);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue