Indeed, last layer of SBDL (HAL) provides a one-row RGB565 linebuffer that has to be sent to display one row at a time. I have some code for that, depending on whether SBDL is running on SDL2 or directly on hardware. For ARM Cortex M0+ and ST7735R LCD controller, I resort to my own asm code. While working in my Direct Mode Tests in “Java”, @FManga provided efficient code using inline asm that you can still find in the related thread. Later, frustrated with low framerates, I found that FemtoIDE Java, in part due to its Garbage Collector, was a huge waste of time, and switched to C/C++ and MinLib. I optimized a bit @FManga 's code and this is what I got:
# LineBuffer.S by SkyBerron
// Licensed under the Apache License, Version 2.0 (the “License”);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an “AS IS” BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
.equ LPC_GPIO_PORT_MPIN0, 0xA0002180
.equ LPC_GPIO_PORT_MPIN1, 0xA0002184
.equ LPC_GPIO_PORT_MPIN2, 0xA0002188
.equ LPC_GPIO_PORT_CLR0, 0xA0002280
.equ LPC_GPIO_PORT_CLR1, 0xA0002284
.equ LPC_GPIO_PORT_CLR2, 0xA0002288
.equ LPC_GPIO_PORT_SET0, 0xA0002200
.equ LPC_GPIO_PORT_SET1, 0xA0002204
.equ LPC_GPIO_PORT_SET2, 0xA0002208
.equ LPC_GPIO_PORT_NOT0, 0xA0002300
.equ LPC_GPIO_PORT_NOT1, 0xA0002304
.equ LPC_GPIO_PORT_NOT2, 0xA0002308
.equ LCD_CD_PORT, 0
.equ LCD_CD_PIN, 2
.equ LCD_WR_PORT, 1
.equ LCD_WR_PIN, 12
.equ LCD_RD_PORT, 1
.equ LCD_RD_PIN, 24
.equ LCD_RES_PORT, 1
.equ LCD_RES_PIN, 0
.equ LCD_CD_SET, LPC_GPIO_PORT_SET0
.equ LCD_CD_CLR, LPC_GPIO_PORT_CLR0
.equ LCD_WR_SET, LPC_GPIO_PORT_SET1
.equ LCD_WR_CLR, LPC_GPIO_PORT_CLR1
.equ LCD_RD_SET, LPC_GPIO_PORT_SET1
.equ LCD_RD_CLR, LPC_GPIO_PORT_CLR1
.equ LCD_RES_SET, LPC_GPIO_PORT_SET1
.equ LCD_RES_CLR, LPC_GPIO_PORT_CLR1
.equ LCD_MPIN, LPC_GPIO_PORT_MPIN2
.type sendLinebuffer, %function
// extern “C” void sendLinebuffer( unsigned short *s, int n );
// r0 : unsigned short *s
// r1 : int n
// The first four arguments are passed in R0 to R3, the rest is passed on the stack.
// The return values is returned in R0.
// The registers other than R0 to R3 must be saved and restored.
ldr r3, =LCD_MPIN
ldr r4, =LCD_WR_CLR
ldr r5, =(1<<LCD_WR_PIN)
ldrh r2, [r0]
adds r0, 2
lsls r2, 3
str r2, [r3] // write color
str r5, [r4]
ldrh r2, [r0]
subs r1, 1
str r5, [r3, (LCD_WR_SET-LCD_MPIN)] // (LCD_WR_SET-LCD_MPIN)] = 124
It’s simple, it’s fast. But I don’t know if it suits your needs being in asm and requiring one row of RGB565 16 bit values.