Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow little-endian for ST7789 #60

Open
jhnlmn opened this issue May 6, 2021 · 3 comments
Open

Allow little-endian for ST7789 #60

jhnlmn opened this issue May 6, 2021 · 3 comments

Comments

@jhnlmn
Copy link

jhnlmn commented May 6, 2021

I found that I can insert
{ST7789_DISPON, {0}, 0x80}, //existing line
#if LV_COLOR_16_SWAP == 0 // Test: enable little endian.
{ST7789_RAMCTRL, {0, 8}, 2}, // Test: enable little endian.
#endif //DL: enable little endian.
{0, {0}, 0xff}, //existing line
to st7789_init_cmds in st7789.c
and now I can build with CONFIG_LV_COLOR_16_SWAP=n
and make LVGL code 500 bytes smaller and more efficient.

Note that ST7789VW doc says "Note: Little Endian only can be supported in 65K 8-bit and 9-bit interface.", so this trick may not work for everyone, but it seem to work for me (I am using SPI, of course).

Also, it will be nice to remove "static" from "static void st7789_send_cmd(uint8_t cmd)" and "static void st7789_send_data(void * data, uint16_t length)"
so I can experiment with register programming from my own code.

Thank you

@C47D
Copy link
Collaborator

C47D commented May 7, 2021

Hi, I will try to add support for it and remove the static from the functions so you can add custom configuration, this weekend I might be free.

@C47D
Copy link
Collaborator

C47D commented May 10, 2021

I've pushed the branch st7789_expose_cmd_api where st7789_send_cmd and st7789_send_data are available outside st7789.c, can you test it?

@jhnlmn
Copy link
Author

jhnlmn commented May 18, 2021

Yes
I added
#if LV_COLOR_16_SWAP==0
//CONFIG_LV_COLOR_16_SWAP=n is more efficient for little endian platforms
st7789_send_cmd(ST7789_RAMCTRL);
st7789_send_data( (uint8_t[]) {0, 8}, 2);
#endif
to guiTask in main.c
and it works OK for both
CONFIG_LV_COLOR_16_SWAP=n
and
CONFIG_LV_COLOR_16_SWAP=y
I recommend CONFIG_LV_COLOR_16_SWAP=n

  • code is smaller and more efficient.

Also, I suggest you add
#if LV_COLOR_16_SWAP == 0
{ST7789_RAMCTRL, {0, 8}, 2},
#endif
to st7789_init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants