> For most devices it is enough to just probe the switch periodically.
Often you want to use interrupts instead of polling - well again, you can just ignore subsequent interrupts if they are within too short of an interval.
Fortunately on many MCUs you can just enable hardware debounce.