/*********************************************************************
 * INCLUDES
 */
#include "nrf_drv_gpiote.h"
#include "app_timer.h" 
#include "app_error.h"

#include "board_gpi.h"
#include "nrf_gpio.h"


#include "our_service.h"

//const uint8_t m_board_led_list[4] = { CTRL_LED_EN, CTRL_BUZZER_EN, CTRL_MIC_EN, CTRL_SPEAKER_EN };
const uint8_t m_board_led_list[4] = { CTRL_LED_EN, CTRL_BUZZER_EN, CTRL_MIC_EN, CTRL_SPEAKER_EN };
//const uint8_t m_board_led_list[4] = { LED_1, LED_2, LED_3, LED_4};


void ParkOutputsOff(void)
{
    uint32_t i;
    for (i = 0; i < 4; ++i)
    {
        //bsp_board_led_off(m_board_led_list[i]);
        nrf_gpio_pin_write(m_board_led_list[i],1);
    }
}

void ParkOutputsOn(void)
{
    uint32_t i;
    for (i = 0; i < 4; ++i)
    {
        //bsp_board_led_on(m_board_led_list[i]);
        nrf_gpio_pin_write(m_board_led_list[i],0);
    }
}




void ParkOutputTest()
{

  static char toggle = 0;

   if( SystemTimer.MS_1 < 1000 )
    return;

    SystemTimer.MS_1 = 0;


    if( toggle++ & 0x01 )
    {
      ParkOutputsOn();
    }else{
    
     ParkOutputsOff();
    }
  


}



void PKLedOn(void)
{
  // ParkOutputsOff();
     nrf_gpio_pin_write(m_board_led_list[0],1);
}


void PKLedOff(void)
{
  // ParkOutputsOn();
     nrf_gpio_pin_write(m_board_led_list[0],0);
}


void PKBuzzerOn(void)
{
  // ParkOutputsOff();
     nrf_gpio_pin_write(m_board_led_list[1],1);
}


void PKBuzzerOff(void)
{
  // ParkOutputsOn();
     nrf_gpio_pin_write(m_board_led_list[1],0);
}

void PKMicOn(void)
{
  // ParkOutputsOff();
     nrf_gpio_pin_write(m_board_led_list[2],1);
}


void PKMicOff(void)
{
  // ParkOutputsOn();
     nrf_gpio_pin_write(m_board_led_list[2],0);
}


void PKSpeakerOn(void)
{
  // ParkOutputsOff();
     nrf_gpio_pin_write(m_board_led_list[3],1);
}


void PKSpeakerOff(void)
{
  // ParkOutputsOn();
     nrf_gpio_pin_write(m_board_led_list[3],0);
}