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


#define ARENA_MIN(A, B) ( A < B ? A : B )

#define ARENA_HAS_ADC               1
#define ARENA_ADC_0                 eAdc1
#define ARENA_HAS_ADC_0_CHANNELS    1
#define ARENA_ADC_0_NAME            Adc1
#define ARENA_ADC_0_CHANNEL_0       (1+0) /* eAdcChannel0==1 */

#define ARENA_HAS_LED               1
#define ARENA_LED_0                 eGpioPeripheralA, eGpioPin5   // Pin D13,LD3
#define ARENA_LED_NATIVE            1

#define ARENA_HAS_GPIO              11
#define ARENA_GPIO_0                eGpioPeripheralA, eGpioPin6   /* Pin D12 */
#define ARENA_GPIO_0_EXTI_IRQ       EXTI9_5_IRQHandler
#define ARENA_GPIO_1                eGpioPeripheralA, eGpioPin7   /* Pin D11 */
#define ARENA_GPIO_1_EXTI_IRQ       EXTI9_5_IRQHandler
#define ARENA_GPIO_2                eGpioPeripheralA, eGpioPin8
#define ARENA_GPIO_2_EXTI_IRQ       EXTI8_IRQHandler
#define ARENA_GPIO_3                eGpioPeripheralA, eGpioPin0
#define ARENA_GPIO_3_EXTI_IRQ       EXTI0_IRQHandler
#define ARENA_GPIO_4                eGpioPeripheralA, eGpioPin1
#define ARENA_GPIO_4_EXTI_IRQ       EXTI1_IRQHandler
#define ARENA_GPIO_5                eGpioPeripheralA, eGpioPin3
#define ARENA_GPIO_5_EXTI_IRQ       EXTI4_IRQHandler
#define ARENA_GPIO_6                eGpioPeripheralA, eGpioPin4
#define ARENA_GPIO_7                eGpioPeripheralF, eGpioPin2
#define ARENA_GPIO_8                eGpioPeripheralF, eGpioPin3
#define ARENA_GPIO_9                eGpioPeripheralF, eGpioPin4
#define ARENA_GPIO_10               eGpioPeripheralF, eGpioPin5

#define ARENA_BUTON_0               eGpioPeripheralF, eGpioPin0
#define ARENA_BUTTON_0_EXTI_IRQ     EXTI0_IRQHandler

#if ARENA_WANT_WATCHDOG > 0
   #define ARENA_USE_WATCHDOG       1
   #define ARENA_WATCHDOG_1         1
#endif

#define ARENA_RETAIN_1              1
#define ARENA_RETAIN_2              2

#define ARENA_HAS_SPI            5
   #if 1
   #define ARENA_SPI_0           eSpi1, \
                                 eGpioPeripheralB, eGpioPin3, /* Pin D3 SCK  */ \
                                 eGpioPeripheralB, eGpioPin5, /* Pin D4 MOSI */ \
                                 eGpioPeripheralB, eGpioPin4  /* Pin D5 MISO */
   #endif
   #if 0
   // Printed on the PCB via ST; but PA5 is Heartbeat
   #define ARENA_SPI_0        eSpi1, \
                              eGpioPeripheralA, eGpioPin5, /* Pin A4  SCK  */ \
                              eGpioPeripheralA, eGpioPin7, /* Pin A6  MOSI */ \
                              eGpioPeripheralA, eGpioPin6  /* Pin A5  MISO */
   #endif
   #if 0
   #define ARENA_SPI_0        eSpi1, \
                              eGpioPeripheralA, eGpioPin5, /* Pin A4  SCK  */ \
                              eGpioPeripheralB, eGpioPin5, /* Pin D11 MOSI */ \
                              eGpioPeripheralA, eGpioPin6  /* Pin A5  MISO */
   #endif

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


#define ARENA_HAS_RTC         1
#define ARENA_RTC_0           yep

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

#define ARENA_HAS_CAN            1
#define ARENA_CAN_0           eCan1, \
                              eGpioPeripheralA, eGpioPin12, /* Pin D2  Tx  */ \
                              eGpioPeripheralA, eGpioPin11  /* Pin D10 Rx */ \


//---fin-----------------------------------------------------------------------
#endif // ? ! _ARENA_BOARD_CONFIG_F334_H_
