board_gpi.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*********************************************************************
  2. * INCLUDES
  3. */
  4. #include "nrf_drv_gpiote.h"
  5. #include "app_timer.h"
  6. #include "app_error.h"
  7. #include "board_gpi.h"
  8. #include "nrf_gpio.h"
  9. #include "our_service.h"
  10. //const uint8_t m_board_led_list[4] = { CTRL_LED_EN, CTRL_BUZZER_EN, CTRL_MIC_EN, CTRL_SPEAKER_EN };
  11. const uint8_t m_board_led_list[4] = { CTRL_LED_EN, CTRL_BUZZER_EN, CTRL_MIC_EN, CTRL_SPEAKER_EN };
  12. //const uint8_t m_board_led_list[4] = { LED_1, LED_2, LED_3, LED_4};
  13. void ParkOutputsOff(void)
  14. {
  15. uint32_t i;
  16. for (i = 0; i < 4; ++i)
  17. {
  18. //bsp_board_led_off(m_board_led_list[i]);
  19. nrf_gpio_pin_write(m_board_led_list[i],1);
  20. }
  21. }
  22. void ParkOutputsOn(void)
  23. {
  24. uint32_t i;
  25. for (i = 0; i < 4; ++i)
  26. {
  27. //bsp_board_led_on(m_board_led_list[i]);
  28. nrf_gpio_pin_write(m_board_led_list[i],0);
  29. }
  30. }
  31. void ParkOutputTest()
  32. {
  33. static char toggle = 0;
  34. if( SystemTimer.MS_1 < 1000 )
  35. return;
  36. SystemTimer.MS_1 = 0;
  37. if( toggle++ & 0x01 )
  38. {
  39. ParkOutputsOn();
  40. }else{
  41. ParkOutputsOff();
  42. }
  43. }
  44. void PKLedOn(void)
  45. {
  46. // ParkOutputsOff();
  47. nrf_gpio_pin_write(m_board_led_list[0],1);
  48. }
  49. void PKLedOff(void)
  50. {
  51. // ParkOutputsOn();
  52. nrf_gpio_pin_write(m_board_led_list[0],0);
  53. }
  54. void PKBuzzerOn(void)
  55. {
  56. // ParkOutputsOff();
  57. nrf_gpio_pin_write(m_board_led_list[1],1);
  58. }
  59. void PKBuzzerOff(void)
  60. {
  61. // ParkOutputsOn();
  62. nrf_gpio_pin_write(m_board_led_list[1],0);
  63. }
  64. void PKMicOn(void)
  65. {
  66. // ParkOutputsOff();
  67. nrf_gpio_pin_write(m_board_led_list[2],1);
  68. }
  69. void PKMicOff(void)
  70. {
  71. // ParkOutputsOn();
  72. nrf_gpio_pin_write(m_board_led_list[2],0);
  73. }
  74. void PKSpeakerOn(void)
  75. {
  76. // ParkOutputsOff();
  77. nrf_gpio_pin_write(m_board_led_list[3],1);
  78. }
  79. void PKSpeakerOff(void)
  80. {
  81. // ParkOutputsOn();
  82. nrf_gpio_pin_write(m_board_led_list[3],0);
  83. }