/**
 * Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
 * 
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 * 
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 * 
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 * 
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 * 
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */
#ifndef PCA10040_H
#define PCA10040_H

#ifdef __cplusplus
extern "C" {
#endif

#include "nrf_gpio.h"

/*-< Output port for status confirmation(TEST) >-*/
#define SIGNAL_OUT_P1	18						/* Signal out port : P0.18 (22Pin) */
#define PORT_HI			 1						/* Signal out port Hi level  */
#define PORT_LOW		 0						/* Signal out port Low level */

/*-< PWM Port >-*/
#define BSP_PWM_0		 9						/* P0.09/NFC		(14Pin) */
#define BSP_PWM_1		10						/* P0.10/NFC		(15Pin) */

#define LEDS_NUMBER		 0						/* Number of LEDs */

/*-<BUTTON setting >-*/
#define BUTTONS_NUMBER	 3
#define BUTTON_START	20						/* Button Start */
#define BUTTON_1		20						/* P0.20/TRACECLK	(25Pin) */
#define BUTTON_2		21						/* P0.21/RESET		(19Pin) */
#define BUTTON_3		28						/* P0.28/AIN4 		(24Pin) */
#define BUTTON_STOP		28						/* Button stop */
/*<condition >*/
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP		/* button hi port setting */
#define BUTTONS_ACTIVE_STATE 0					/* button port active setting */
/*<table>*/
#define BUTTONS_LIST { BUTTON_1, BUTTON_2, BUTTON_3}
#define BSP_BUTTON_0   BUTTON_1					/* P0.20/TRACECLK	(25Pin) */
#define BSP_BUTTON_1   BUTTON_2					/* P0.21/RESET		(19Pin) */
#define BSP_BUTTON_2   BUTTON_3					/* P0.28/AIN4 		(24Pin) */

/*-<UART Port >-*/
#define RX_PIN_NUMBER  8						/* RX  UART pin setting		 */
#define TX_PIN_NUMBER  6						/* TX  UART pin setting		 */
#define CTS_PIN_NUMBER 7						/* CTS UART pin setting		 */
#define RTS_PIN_NUMBER 5						/* RTS UART pin setting		 */
#define HWFC           true						/* UART commnication setting */

// Low frequency clock source to be used by the SoftDevice
#if 0
#define NRF_CLOCK_LFCLKSRC      {.source       = NRF_CLOCK_LF_SRC_XTAL,			\
								 .rc_ctiv      = 0,								\
								 .rc_temp_ctiv = 0,								\
								 .accuracy     = NRF_CLOCK_LF_ACCURACY_20_PPM}
#else
#define NRF_CLOCK_LFCLKSRC      {.source       = NRF_CLOCK_LF_SRC_RC,			\
								 .rc_ctiv      = 16,							\
								 .rc_temp_ctiv = 2,								\
								 .accuracy     = 0}
#endif
								 
#ifdef __cplusplus
}
#endif

#endif // PCA10040_H
