#ifndef _ARENA_BOARD_CONFIG_F103_H_
#define _ARENA_BOARD_CONFIG_F103_H_
//-----------------------------------------------------------------------------
///
/// \brief  Libbiwak board description
///
///         Basic STM32F103 Nucleo board
///
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//-----------------------------------------------------------------------------


#include <arena/boards/generic_stm32.h>    // Based on STM32 board


#define ARENA_ADC_0           eAdc1

#define ARENA_ADC_TEMPERATURE_INDEX    0
#define ARENA_ADC_TEMPERATURE_CHANNEL  16

#define ARENA_HAS_LED         1
#define ARENA_LED_0           eGpioPeripheralA, eGpioPin5   // // LD2, Pin D13, GRN
//#define ARENA_LED_2           eGpioPeripheralC, eGpioPin8
// #define ARENA_LED_3           eGpioPeripheralB, eGpioPin6 // I2C SCL
//#define ARENA_LED_3           eGpioPeripheralB, eGpioPin123

#define ARENA_HAS_OUT         2
#define ARENA_OUT_0           eGpioPeripheralB, eGpioPin0
#define ARENA_OUT_1           eGpioPeripheralC, eGpioPin9

#define ARENA_HAS_BUTTON         1
#define ARENA_BUTTON_0        eGpioPeripheralC, eGpioPin13  // User Button B1
#define ARENA_BUTTON_0_EXTI_IRQ EXTI15_10_IRQHandler

#define ARENA_WATCHDOG_1      1
#define ARENA_RETAIN_1        1
#define ARENA_RETAIN_2        1

#define ARENA_HAS_UART        1
#define ARENA_UART_0          eUsart2, \
                              eGpioPeripheralA, eGpioPin2,  /* Tx yel  D1 */ \
                              eGpioPeripheralA, eGpioPin3   /* RX red  D0 */
#define ARENA_UART_0_IRQ      USART2_IRQHandler

#define ARENA_HAS_I2C            1
#define ARENA_I2C_0           eI2c1, \
                              eGpioPeripheralB, eGpioPin6,      /* SCL */ \
                              eGpioPeripheralB, eGpioPin7      /* SDA */

#define ARENA_HAS_GPIO        3
#define ARENA_GPIO_0          eGpioPeripheralC, eGpioPin3   // Pin CN7 37 (left)
#define ARENA_GPIO_0_EXTI_IRQ EXTI3_IRQHandler
#define ARENA_GPIO_1          eGpioPeripheralC, eGpioPin8
#define ARENA_GPIO_1_EXTI_IRQ EXTI8_IRQHandler
//#define ARENA_IR_1            eGpioPeripheralC, eGpioPin2   // Pin CN7 35 (left)
#define ARENA_GPIO_2          eGpioPeripheralC, eGpioPin2   // Pin CN7 35 (left)
#define ARENA_GPIO_2_EXTI_IRQ EXTI2_IRQHandler


#define ARENA_HAS_RTC         1
#define ARENA_RTC_0           yep

#define ARENA_HAS_SPI 1
/* MOSI does not work on STM32F1 with I2C on PB6...PB7 */
#define NO_ARENA_SPI_0        eSpi1, \
                              eGpioPeripheralB, eGpioPin3,     /* SCK  D3 */ \
                              eGpioPeripheralB, eGpioPin5,     /* MOSI D4 */ \
                              eGpioPeripheralB, eGpioPin4      /* MISO D5 */
// PA5...PA7 should work (default constelation on st nucleo stm32f103) but would
// loose led
#define ARENA_SPI_0           eSpi2, \
                              eGpioPeripheralB, eGpioPin13,     /* SCK  VaV D4 */ \
                              eGpioPeripheralB, eGpioPin15,     /* MOSI VaV D6 */ \
                              eGpioPeripheralB, eGpioPin14      /* MISO VaV D5 */


//---fin-----------------------------------------------------------------------
#endif // ? ! _ARENA_BOARD_CONFIG_F103_H_
