main.c 819 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*!
  2. \file main.c
  3. \brief keyboard polling mode
  4. */
  5. /*
  6. Copyright (C) 2017 GigaDevice
  7. 2017-06-06, V1.0.0, firmware for GD32F3x0
  8. */
  9. #include "gd32f3x0.h"
  10. #include "gd32f3x0_libopt.h"
  11. #include "systick.h"
  12. #include "gd32f3x0_eval.h"
  13. #include <stdio.h>
  14. /*!
  15. \brief main function
  16. \param[in] none
  17. \param[out] none
  18. \retval none
  19. */
  20. int main(void)
  21. {
  22. systick_config();
  23. gd_eval_led_init(LED1);
  24. gd_eval_key_init(KEY_TAMPER,KEY_MODE_GPIO);
  25. while(1){
  26. /* check whether the button is pressed */
  27. if(RESET == gd_eval_key_state_get(KEY_TAMPER)){
  28. delay_1ms(100);
  29. /* check whether the button is pressed */
  30. if(RESET == gd_eval_key_state_get(KEY_TAMPER)){
  31. gd_eval_led_toggle(LED1);
  32. }
  33. }
  34. }
  35. }