Refer to: http://www.atakansarioglu.com/embedded-system-tick-timer/
Porting this to any platform is easy. Create your own ticker_hw.c (and ticher_hw.c) file similar to the (STM32F100 based) example files provided in the repository. You don't need to modify ticker.h and ticker.c library files.