CommunityGD32Cores / ArduinoCore-GD32

Arduino core for GD32 devices, community developed, based on original GigaDevice's core
Other
89 stars 33 forks source link

Assign LED2 to PB2 for Generic variant. #34

Closed bjc closed 3 years ago

bjc commented 3 years ago

This allows the Blink example to compile and work on the BluePill clone.

maxgerhardt commented 3 years ago

Which blink example are you refering to? The example at https://github.com/CommunityGD32Cores/gd32-pio-projects/blob/main/gd32-arduino-blinky/src/main.cpp uses LED_BUILTIN, which that variant.h has.

Also the bluepills I know only have one user LED, having LED_BUILTIN PC13 and LED2 PB2 in there as if there are two feels weird. Do you have a link to the hardware? If it's different hardware then a different board definition should be created.

bjc commented 3 years ago

The example in this repo, which would be used by the Arduino IDE: https://github.com/CommunityGD32Cores/ArduinoCore-GD32/blob/main/libraries/Blink/examples/Blink/Blink.ino

I'm not averse to changing this to LED_BUILTIN, but PC13 won't work (I just tried it). It's definitely PB2.

As far as what board it is, I'm not sure -- @obra mailed them to me, so maybe he can chime in?

maxgerhardt commented 3 years ago

I've seen the e.g. ESP8266 core and STM32 core let the user choose the "LED_BUILTIN" value per a menu config -- maybe we need something like that too if you were to keep a generic bluepill variant. For now I can see "LED2" as "alternative LED if LED_BUILTIN wasn't correct for your board" though.