Sort:  

If you use the stm32duino there are standard libraries that are already ported.
You can check those threads for more details :

If you want to put shields it is another story I think, voltage and features on a given IO can be problematic. It depends on the target board you want to use.