/**
  ******************************************************************************
  * @file    DMA/M2M/platform_config.h 
  * @author  IOT Development Team
  * @version V1.0.0
  * @date    10-January-2020
  * @brief   Evaluation board specific configuration file.
  ******************************************************************************
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __PLATFORM_CONFIG_H
#define __PLATFORM_CONFIG_H

/* Includes ------------------------------------------------------------------*/

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
#define APM32_MINI
//#define APM32_DISCOVERY
//#define APM32F103V_EVAL

#if defined(APM32_MINI)
 #include "apm32_mini.h"
#elif defined (APM32_DISCOVERY)
 #include "apm32_discovery.h"
#elif defined (APM32F103V_EVAL)
 #include "apm32f103v_eval.h"
#endif

  #define SPI_MASTER                   SPI1
  #define SPI_MASTER_CLK               RCC_APB2Periph_SPI1
  #define SPI_MASTER_GPIO              GPIOA
  #define SPI_MASTER_GPIO_CLK          RCC_APB2Periph_GPIOA  
  #define SPI_MASTER_PIN_SCK           GPIO_Pin_5
  #define SPI_MASTER_PIN_MISO          GPIO_Pin_6
  #define SPI_MASTER_PIN_MOSI          GPIO_Pin_7
  #define SPI_MASTER_DMA               DMA1
  #define SPI_MASTER_DMA_CLK           RCC_AHBPeriph_DMA1  
  #define SPI_MASTER_Rx_DMA_Channel    DMA1_Channel2
  #define SPI_MASTER_Rx_DMA_FLAG       DMA1_FLAG_TC2
  #define SPI_MASTER_Tx_DMA_Channel    DMA1_Channel3
  #define SPI_MASTER_Tx_DMA_FLAG       DMA1_FLAG_TC3  
  #define SPI_MASTER_DR_Base           0x4001300C
  
  #define SPI_SLAVE                    SPI2
  #define SPI_SLAVE_CLK                RCC_APB1Periph_SPI2
  #define SPI_SLAVE_GPIO               GPIOB
  #define SPI_SLAVE_GPIO_CLK           RCC_APB2Periph_GPIOB 
  #define SPI_SLAVE_PIN_SCK            GPIO_Pin_13
  #define SPI_SLAVE_PIN_MISO           GPIO_Pin_14
  #define SPI_SLAVE_PIN_MOSI           GPIO_Pin_15 
  #define SPI_SLAVE_DMA                DMA1
  #define SPI_SLAVE_DMA_CLK            RCC_AHBPeriph_DMA1  
  #define SPI_SLAVE_Rx_DMA_Channel     DMA1_Channel4
  #define SPI_SLAVE_Rx_DMA_FLAG        DMA1_FLAG_TC4
  #define SPI_SLAVE_Tx_DMA_Channel     DMA1_Channel5
  #define SPI_SLAVE_Tx_DMA_FLAG        DMA1_FLAG_TC5  
  #define SPI_SLAVE_DR_Base            0x4000380C
          

/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */

#endif /* __PLATFORM_CONFIG_H */

