22. Debounce switch input

A mechanical switch SW1 controls a 3.3 V GPIO input but may produce short unwanted transitions.

Using the provided R_PULL = 10 kΩ and a 1 µF capacitor, design an RC debounce circuit so that:

  • A short 0.2 ms switch closure keeps GPIO_IN ≥ 2 V.
  • When SW1 stays closed for 10 ms, GPIO_IN ≤ 0.8 V.
  • When SW1 remains open, GPIO_IN ≥ 2 V.

Example test cases:

SW1 ConditionRequired GPIO_IN
Open, settled≥2 V
Closed for 0.2 ms≥2 V
Closed for 10 ms≤0.8 V