Closed dotsam closed 7 months ago
I cant find the original discussion but I believe we implemented directly setting the LEDs like that as we could do it in fewer cycles which (IIRC) did provide a noticeable speed bump. Is there any way you could run a side by side comparison of your change and the original way to ensure there's not a regression in speed?
I’m still waiting for some parts to build up my BlueSCSI, so I can’t do any benchmarking right now, but I’ll take another look and see if I can use some constants and bitshifting and bitwise operators to accomplish this like was being done before
Alright, tried again, this time using all macros and defines so that everything gets sorts out at compile time, and this should generate the same code as before. Not quite as nice to only have to set a single define to change the pin, but not horrendous either, and a little less opaque to anyone else trying to read or change this code
Rebased this, swapped the pin initialization back to the same order, and then confirmed that this builds a byte-for-byte binary against main
35db1cd8e3f846ee80ab394cce9d4fd2 BlueSCSI-v1.1-20240209-STM32F1-USB-128MHz.bin
6ce93afa5bd32069d8f170d5b9c7974e BlueSCSI-v1.1-20240209-STM32F1-USB-96MHz.bin
22e7f7308dd540a7e0c9b811f9ae2b0d BlueSCSI-v1.1-20240209-STM32F1-USB.bin
41c58cc137ef4ce37b3e8b49456c8ed6 BlueSCSI-v1.1-20240209-STM32F1-XCVR.bin
00eed42ed15e163f9fc875f50b45a4d6 BlueSCSI-v1.1-20240209-STM32F1.bin
35db1cd8e3f846ee80ab394cce9d4fd2 easy-leds/BlueSCSI-v1.1-20240209-STM32F1-USB-128MHz.bin
6ce93afa5bd32069d8f170d5b9c7974e easy-leds/BlueSCSI-v1.1-20240209-STM32F1-USB-96MHz.bin
22e7f7308dd540a7e0c9b811f9ae2b0d easy-leds/BlueSCSI-v1.1-20240209-STM32F1-USB.bin
41c58cc137ef4ce37b3e8b49456c8ed6 easy-leds/BlueSCSI-v1.1-20240209-STM32F1-XCVR.bin
00eed42ed15e163f9fc875f50b45a4d6 easy-leds/BlueSCSI-v1.1-20240209-STM32F1.bin
I've got a BluePill with slightly different pins in use for the internal LED and PA0, and in trying to change them, I wanted an easier way to do so in the defines.
Switched from setting the GPIO register directly to using gpio_write, which does add 104 bytes or so