#ifndef _CONFIGURATION_H_
#define _CONFIGURATION_H_

#define NO 0x01
#define YES 0x02

#define AT25F2048  0x01
#define AT45DB041  0x02
#define AT25DF041A 0x03
#define W25X20CV 0x04
#define M25P40VMN6PB 0x05

#define CRYSTAL_12MHz     0x01
#define CRYSTAL_16MHz     0x02
#define CRYSTAL_18d432MHz 0x03

// Use external memory
#define EXTERNAL_MEMORY AT25DF041A
//#define EXTERNAL_MEMORY M25P40VMN6PB
//#define EXTERNAL_MEMORY AT25F2048
//#define EXTERNAL_MEMORY W25X20CV
//#define EXTERNAL_MEMORY AT45DB041

// Rcb_bb RS-232 controller
#define RCB_BB_RS232_CONTROLLER YES
//#define RCB_BB_RS232_CONTROLLER NO

// Key remote RS-232 controller
#define KEY_REMOTE_RS232_CONTROLLER NO
//#define KEY_REMOTE_RS232_CONTROLLER YES

// MCU crystal frequency for Sam3s
#define CRYSTAL_FREQUENCY CRYSTAL_12MHz
//#define CRYSTAL_FREQUENCY CRYSTAL_16MHz
//#define CRYSTAL_FREQUENCY CRYSTAL_18d432MHz

//-----------------------------------------------
//ATMEGA128RFA1
//-----------------------------------------------
#ifdef ATMEGA128RFA1
  // Use USART0
  #define USE_USART0 0
  //#define USE_USART0 1
  
  // Use USART1
  #define USE_USART1 1
  //#define USE_USART1 0
  
  // Use SPI
  #define USE_SPI 0
  //#define USE_SPI 1
  
  // Use USB_FIFO
  #define USE_USB_FIFO 0
  //#define USE_USB_FIFO 1
  
  // Use TWID. USART shall not be used at the same time
  #define USE_TWIS_D 0
  //#define USE_TWIS_D 1
#endif

//-----------------------------------------------
//ATSAMR21G18A
//-----------------------------------------------
#ifdef ATSAMR21G18A
  // Enable BL security
  #define USE_IMAGE_SECURITY 0
  //#define USE_IMAGE_SECURITY 1
  
  // Use external memory
  #undef EXTERNAL_MEMORY
  #define EXTERNAL_MEMORY M25P40VMN6PB
  
  // Rcb_bb RS-232 controller
  #undef RCB_BB_RS232_CONTROLLER
  #define RCB_BB_RS232_CONTROLLER NO
  
  // Key remote RS-232 controller
  #undef KEY_REMOTE_RS232_CONTROLLER
  #define KEY_REMOTE_RS232_CONTROLLER NO
  
  // Use USART0
  #define USE_USART0 1
  
  // Use SPI
  #define USE_SPI 1
  
  // Supported boards
  #define BOARD_SAMR21_ZLLEK
  //#define BOARD_SAMR21_XPRO
#endif //

//-----------------------------------------------
//AT91SAM3S4C
//-----------------------------------------------
#ifdef AT91SAM3S4C
  // Use USB DFU class
  #define USE_USB_DFU 1
  //#define USE_USB_DFU 0
  
  // Key remote RS-232 controller
  #undef KEY_REMOTE_RS232_CONTROLLER
  #define KEY_REMOTE_RS232_CONTROLLER NO
  
  // Rcb_bb RS-232 controller
  #undef RCB_BB_RS232_CONTROLLER
  #define RCB_BB_RS232_CONTROLLER NO
#endif

//-----------------------------------------------
//ATSAMR21E18A
//-----------------------------------------------
#ifdef ATSAMR21E18A
  // Use external memory
  #undef EXTERNAL_MEMORY
  #define EXTERNAL_MEMORY W25X20CV
  
  // Enable BL security
  #define USE_IMAGE_SECURITY 0
  //#define USE_IMAGE_SECURITY 1
  
  // Key remote RS-232 controller
  #undef KEY_REMOTE_RS232_CONTROLLER
  #define KEY_REMOTE_RS232_CONTROLLER NO
  
  // Use USART0
  #define USE_USART0 1
  
  // Supported boards
  #define BOARD_SAMR21_CUSTOM
  
  // Use SPI
  #define USE_SPI 1
  
  // Rcb_bb RS-232 controller
  #undef RCB_BB_RS232_CONTROLLER
  #define RCB_BB_RS232_CONTROLLER NO
#endif //

//-----------------------------------------------
//ATMEGA2564RFR2
//-----------------------------------------------
#ifdef ATMEGA2564RFR2
  // Enable SPM interrupt
  #define RFR2_SPM 1
  //#define RFR2_SPM 0
  
  // Use TWID. USART shall not be used at the same time
  #define USE_TWIS_D 0
  //#define USE_TWIS_D 1
  
  // Use USART1
  #define USE_USART1 1
  //#define USE_USART1 0
  
  // Use USB_FIFO
  #define USE_USB_FIFO 0
  //#define USE_USB_FIFO 1
  
  // Enable BL security
  #define USE_IMAGE_SECURITY 0
  //#define USE_IMAGE_SECURITY 1
  
  // Use USART0
  #define USE_USART0 0
  //#define USE_USART0 1
  
  // Use SPI
  #define USE_SPI 0
  //#define USE_SPI 1
#endif //

//-----------------------------------------------
//ATMEGA1281
//-----------------------------------------------
#ifdef ATMEGA1281
  // Use TWID. USART shall not be used at the same time
  #define USE_TWIS_D 0
  //#define USE_TWIS_D 1
  
  // Use USART1
  #define USE_USART1 1
  //#define USE_USART1 0
  
  // Use USART0
  #define USE_USART0 0
  //#define USE_USART0 1
  
  // Use USB_FIFO
  #define USE_USB_FIFO 0
  //#define USE_USB_FIFO 1
#endif

//-----------------------------------------------
//ATXMEGA256D3
//-----------------------------------------------
#ifdef ATXMEGA256D3
  // Use USARTD0
  #define USE_USARTD0 1
  //#define USE_USARTD0 0
  
  // Use TWIC. USART shall not be used at the same time
  #define USE_TWIS_C 0
  //#define USE_TWIS_C 1
  
  // Key remote RS-232 controller
  #undef KEY_REMOTE_RS232_CONTROLLER
  #define KEY_REMOTE_RS232_CONTROLLER NO
  
  // Rcb_bb RS-232 controller
  #undef RCB_BB_RS232_CONTROLLER
  #define RCB_BB_RS232_CONTROLLER NO
#endif

//-----------------------------------------------
//ATMEGA256RFR2
//-----------------------------------------------
#ifdef ATMEGA256RFR2
  // Use TWID. USART shall not be used at the same time
  #define USE_TWIS_D 0
  //#define USE_TWIS_D 1
  
  // Enable SPM interrupt
  #define RFR2_SPM 1
  //#define RFR2_SPM 0
  
  // Enable BL security
  #define USE_IMAGE_SECURITY 0
  //#define USE_IMAGE_SECURITY 1
  
  // Use USART1
  #define USE_USART1 1
  //#define USE_USART1 0
  
  // Use USART0
  #define USE_USART0 0
  //#define USE_USART0 1
  
  // Use SPI
  #define USE_SPI 0
  //#define USE_SPI 1
  
  // Use USB_FIFO
  #define USE_USB_FIFO 0
  //#define USE_USB_FIFO 1
#endif //

//-----------------------------------------------
//ATMEGA2561
//-----------------------------------------------
#ifdef ATMEGA2561
  // Use TWID. USART shall not be used at the same time
  #define USE_TWIS_D 0
  //#define USE_TWIS_D 1
  
  // Use USART1
  #define USE_USART1 1
  //#define USE_USART1 0
  
  // Use USART0
  #define USE_USART0 0
  //#define USE_USART0 1
#endif

//-----------------------------------------------
//ATXMEGA256A3
//-----------------------------------------------
#ifdef ATXMEGA256A3
  // Use USARTF0
  #define USE_USARTF0 1
  //#define USE_USARTF0 0
  
  // Use USE_SPIE
  #define USE_SPIE 0
  //#define USE_SPIE 1
  
  // Use TWIE. USART shall not be used at the same time
  #define USE_TWIS_E 0
  //#define USE_TWIS_E 1
  
  // Use TWIC. USART shall not be used at the same time
  #define USE_TWIS_C 0
  //#define USE_TWIS_C 1
  
  // Key remote RS-232 controller
  #undef KEY_REMOTE_RS232_CONTROLLER
  #define KEY_REMOTE_RS232_CONTROLLER NO
  
  // Use USARTD0
  #define USE_USARTD0 1
  //#define USE_USARTD0 0
  
  // Rcb_bb RS-232 controller
  #undef RCB_BB_RS232_CONTROLLER
  #define RCB_BB_RS232_CONTROLLER NO
#endif //

//-----------------------------------------------
//ATXMEGA128A1
//-----------------------------------------------
#ifdef ATXMEGA128A1
  // Use TWIF. USART shall not be used at the same time
  #define USE_TWIS_F 0
  //#define USE_TWIS_F 1
  
  // Use TWID. USART shall not be used at the same time
  #define USE_TWIS_D 0
  //#define USE_TWIS_D 1
  
  // Use TWIE. USART shall not be used at the same time
  #define USE_TWIS_E 0
  //#define USE_TWIS_E 1
  
  // Use TWIC. USART shall not be used at the same time
  #define USE_TWIS_C 0
  //#define USE_TWIS_C 1
  
  // Key remote RS-232 controller
  #undef KEY_REMOTE_RS232_CONTROLLER
  #define KEY_REMOTE_RS232_CONTROLLER NO
  
  // Use USE_SPIE
  #define USE_SPIE 0
  //#define USE_SPIE 1
  
  // Use USARTD0
  #define USE_USARTD0 1
  //#define USE_USARTD0 0
  
  // Rcb_bb RS-232 controller
  #undef RCB_BB_RS232_CONTROLLER
  #define RCB_BB_RS232_CONTROLLER NO
  
  // Use USARTF0
  #define USE_USARTF0 1
  //#define USE_USARTF0 0
#endif //


#endif // _CONFIGURATION_H_
