1. int button_is_pressed(uint8_t _bit)
  2. {
  3. /* the button is pressed when BUTTON_BIT is clear */
  4. if (bit_is_clear(BUTTON_PIN, _bit))
  5. {
  6. delay_ms(DEBOUNCE_TIME);
  7. if (bit_is_clear(BUTTON_PIN, _bit)) return 1;
  8. }
  9. return 0;
  10. }