/**********************************************************************
* Project:      Key scan
* Description:  Scan a key and toogle a led
* Author:       Ma Yufei
* Url:          myflyx.github.io
* Platform:     QF_nRF5188_Pro + MDK473 + SDK6.0 + S110
* Date:         2016.3.21
* Source Work:  QingFeng qfv5.taobao.com
* Taobao URL:   qfv5.taobao.com
**********************************************************************/

#include "nrf51.h"
#include "nrf_gpio.h"
#include "led.h"
#include "key.h"

int main(void)
{
	LED_Init();//Led Init
	KEY_Init();//Key Init
	while(1)
	{
    //Check the key, if the Key is pressing,KEY_Down() will return 0
		if( KEY_Down(KEY_1)== 0)
		{
			LED_Toggle(LED_0);
		}
		else if( KEY_Down(KEY_2)== 0)

		{
			LED_Toggle(LED_1);
		}

		else if( KEY_Down(KEY_3)== 0)

		{
			LED_Toggle(LED_2);
		}
		else if( KEY_Down(KEY_4)== 0)

		{
			LED_Toggle(LED_3);
		}

	}
}
