Software debounce without using delay functions.
debounce.c debounce.h
Necessary explanations are in these modules.