Really?  My understanding was that the F3 had gpio very much _like_ the F1. (And very much unlike the F2,F4,L1, which use this code).  This looks like you copied the F4 code.

Note also, that since you started this work, most of the gpio has been unified.  You should be able to share almost all of this with the f1.