/*! ----------------------------------------------------------------------------
 * @file	GPIO.c
 * @brief	GPIO access function implementations
 * @version 5.0
 * @date 18/05/2017
 */
 
 
#include "GPIO.h"
#include "GlobalDefs.h"
#include "boards.h"
#include "nrf_delay.h" 
 
/**@brief function to Configure NRF52 GPIOs
 *
 */
int GPIO_init(void)
{
	// Set Wakeup output
	nrf_gpio_cfg_output(PIN_DECA_WAKEUP);
	nrf_gpio_pin_write(PIN_DECA_WAKEUP,0);
	
	// Leds
	nrf_gpio_pin_write(LED_2,GPIO_HIGH);
	nrf_gpio_cfg_output(LED_2);
	
	//nrf_gpio_pin_write(14,GPIO_LOW);
	//nrf_gpio_cfg_output(14);
	
    return 0;
}

/**@brief Set an output pin to a value
 *
 * @param[in] 	pin_number  pin to configure
 * @param[in] 	value  		High or low state
 */
void GPIO_SetPinValue (uint32_t pin_number, uint32_t value)
{
	nrf_gpio_pin_write(pin_number,value);
}

/**@brief Toggle an output pin
 *
 * @param[in] 	pin_number  pin to configure
 */
void GPIO_TogglePin (uint32_t pin_number)
{
	nrf_gpio_pin_toggle(pin_number);
}
