Blinkinlabs / ch554_sdcc

CH554 software development kit for SDCC
295 stars 70 forks source link

blink example doesn't work with P3 #31

Open nerdralph opened 3 years ago

nerdralph commented 3 years ago

I changed the blink example to use an function for changing the pin mode, so it will work with any GPIO pin on P1 or P3. https://github.com/nerdralph/ch554_sdcc/blob/master/examples/blink/main.c

The LED GPIO is defined by its SFR bit address. I wanted to use the address of the port bit, but SDCC doesn't permit the address operator on __sbit i.e. pushPull(&P1_4);. If you like this solution, I'll submit a pull request.