CommunityGD32Cores / gd32-pio-projects

PlatformIO test projects for the new GD32 platform and arduino core
42 stars 10 forks source link

gd32303c_eval and LCD library #5

Open ftab opened 2 years ago

ftab commented 2 years ago

Just got my hands on one of these. I ported the touchscreen example project from their demo to a PlatformIO project, but I've had to modify a few things in the gd32 spl package and wanted to bounce this off you to see if I'm headed in the right direction or if I should rethink how I did this.

Or maybe I should start with something more straightforward? (I was also hoping to run some Arduino examples on it, but this board doesn't have a variant yet, I wasn't too sure what to plug into variant.* to make my own)

WIP: https://github.com/ftab/gd32-pio-projects/tree/ftab/touchscreen/gd32-spl-touchscreen-gd32303c-eval

Modified spl package: https://github.com/ftab/gd32-pio-spl-package/tree/ftab/eval_lcd_fix

I think basically what I did was updated the gd32f303c_eval.*, gd32f303c_lcd_eval.*, and "LCD_Commom" files, updated the latter to point to the right include file and remove where it's referencing USB config (? not sure how to include the USB stuff in this project, and it didn't seem to be referenced in the original project either, but I haven't got a build environment set to build from their project files...)

I also had to change main.c slightly, compared to the example project, as it was inverting x coordinates. ¯\_(ツ)_/¯

maxgerhardt commented 2 years ago

I have seen multiple examples of Gigadevice libraries doing.. strange things. Including USB headers when no USB functionality is needed is definitely weird.

Can you link to the original project that you're trying to port to PlatformIO? Are you making any modifications to it like changing the target board?

ftab commented 2 years ago

This one's close: https://github.com/CommunityGD32Cores/gigadevice-firmware-and-docs/tree/main/GD32F30x/GD32F30x_Demo_Suites_V2.2.0/GD32303C_EVAL_Demo_Suites/Projects/15_EXMC_TouchScreen

but I grabbed it from a newer demo suite (2.3.0) off their site http://gd32mcu.com/en/download/8?kw=

I took one of the existing demo projects from here (gd32-spl-blinky-gd32f30x I think?), replaced the contents of the src/ directory with the .c and .h files from there, switched the target board in the .ini to the eval instead of generic, and started trying to build it. That was where I ran into some build errors with the current version of the pio gd32 spl framework.

I had to change the file that lcd_log.h wanted to include, remove the USB stuff from lcd_log.c, and use the newer version of the eval board and LCD support files (gd32f303c_eval and gd32f303c_lcd_eval). I did that last part to get the device_code variable that main.c was expecting, but also it was previously hard coding to one panel type and that didn't match the one I have on my board. (Seems to be one of the changes between demo suite 2.2.0 and 2.3.0)

But after that, it did build and run