/************************************************************
//  Copyright (c)
//  FileName	 : main.c
//  Module Function	:
//  Instructions : Contains the MCU initialization function and its H file
*******************Includes************************************************************************/
#include "SC_Init.h"
#include "SC_it.h"
#include "HeadFiles\SysFunVarDefine.h"
#include "stdio.h"
#include "Function_Init.h"
#include "sc32_conf.h"

/**************************************Generated by EasyCodeCube*************************************/
//Forbid editing areas between the labels !!!

/*************************************.Generated by EasyCodeCube.************************************/
/*****************************************************************************************************
* Function Name: main
* Description  : This function implements main function.
* Arguments    : None
* Return Value : None
******************************************************************************************************/
/* UART3作信息打印使用 */
int fputc(int c, FILE* f)
{
  UART_SendData(UART3, (uint8_t)c);
  while(!UART_GetFlagStatus(UART3, UART_Flag_TX));
  UART_ClearFlag(UART3, UART_Flag_TX);
  return c;
}

int main(void)
{
  /*<Generated by EasyCodeCube begin>*/
  /*<UserCodeStart>*//*<SinOne-Tag><36>*/
  SC_Init();        //HLCK 分频为1分频

  /* 初始化UART3，配置为UART3（TX_PB14，RX_PB13） */
  RCC_APB2Cmd(ENABLE);  //开启APB0时钟
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_UART3, ENABLE); //开启UART3时钟

  {
    UART_InitTypeDef UART_InitStruct;
    UART_InitStruct.UART_BaudRate = 115200;

    UART_InitStruct.UART_ClockFrequency = 32000000;

    UART_InitStruct.UART_Mode = UART_Mode_10B;

    UART_Init(UART3, &UART_InitStruct);

    UART_TXCmd(UART3, ENABLE);
    UART_RXCmd(UART3, ENABLE);
  }
  __enable_irq(); // 开启总中断
 #if defined(SC32f12xx)
  printf("\r\n This is SC32F12xx Demo!!! \r\n");
#elif defined(SC32f10xx)
  printf("\r\n This is SC32F10xx Demo!!! \r\n");
#endif 

  /*<Generated by EasyCodeCube begin>*/
  #if (TestNum == 1)
    GPIO_InOut_Function();
  #elif (TestNum == 2)
    ADC_SingleConversion_Function();
  #elif (TestNum == 3)
    ADC_CycleConversion_DMA_Function();
  #elif (TestNum == 4)
    BTM_Base_Function();
  #elif (TestNum == 5)
    CMP_Interrupt_Function();
  #elif (TestNum == 6)
    CMP_AnalogWatchdog_Function();
  #elif (TestNum == 7)
    CRC_CalculateArrays_Function();
  #elif (TestNum == 8)
    DMA_Burst_Function();
  #elif (TestNum == 9)
    DMA_Pause_Function();
  #elif (TestNum == 10)
    DMA_ScatterGather_Function();
  #elif (TestNum == 11)
    INT_Example_Function();
  #elif (TestNum == 12)
    IAP_Program_Function();
  #elif (TestNum == 13)
    LCD_Example_Function();
  #elif (TestNum == 14)
    LED_Example_Function();
  #elif (TestNum == 15)
    RCC_SystemClockConfig_Function();
  #elif (TestNum == 16)
    PWM_Independent_Function();
  #elif (TestNum == 17)
    PWM_Complementary_Function();
  #elif (TestNum == 18)
    SPI_Communication_Function();
  #elif (TestNum == 19)
    SPI_FIFOMaster_Function();  
  #elif (TestNum == 20)
    SPI_FIFOSlave_Function();
  #elif (TestNum == 21)
    SPI_Communication_DMA_Function();
  #elif (TestNum == 22)
    TIM_TimeBase_Function();
  #elif (TestNum == 23)
    TIM_CounterBase_Function();
  #elif (TestNum == 24)
    TIM_PWMOutput_Function();
  #elif (TestNum == 25)
    TIM_InputCapture_Function();
  #elif (TestNum == 26)
    TIM_TI_DMA_Function();
  #elif (TestNum == 27)
    TWI_Communication_Function();
  #elif (TestNum == 28)
    TWI_Master_DMA_Function();
  #elif (TestNum == 29)
    TWI_Slave_DMA_Function();
  #elif (TestNum == 30)
    UART_Communication_Function();
  #elif (TestNum == 31)
    UART_Communication_DMA_Function();
  #elif (TestNum == 32)
    LEDPWM_Example_Function();
  #elif (TestNum == 33)
    SYSTICK_Example_Function();
  #elif (TestNum == 34)
    STOP_IDLE_WakeUp_Function();
  #elif (TestNum == 35)
    IAP_ReadUID_Example();
  #endif
  /*****MainLoop*****/
  while(1)
  {
    /*<UserCodeStart>*//*<SinOne-Tag><14>*/
    /***User program***/
    /*<UserCodeEnd>*//*<SinOne-Tag><14>*/
    /*<Begin-Inserted by EasyCodeCube for Condition>*/
  }
  /*<UserCodeEnd>*//*<SinOne-Tag><4>*/

  /*<Generated by EasyCodeCube end>*/

}
