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