コード例 #1
0
ファイル: main.c プロジェクト: alenyashka/W7500
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
    /*System clock configuration*/
    SystemInit();
//    *(volatile uint32_t *)(0x41001014) = 0x0060100; //clock setting 48MHz
    
    /* CLK OUT Set */
//    PAD_AFConfig(PAD_PA,GPIO_Pin_2, PAD_AF2); // PAD Config - CLKOUT used 3nd Function
    /* NVIC configuration */
    NVIC_Configuration();

    /* CPIO configuration */
    GPIO_Setting();

    /* Time base configuration */
    CounterModeStruct.PWM_CHn_MR = 10;
    CounterModeStruct.PWM_CHn_LR = 20;
    CounterModeStruct.PWM_CHn_UDMR = PWM_CHn_UDMR_UpCount;
    CounterModeStruct.PWM_CHn_PDMR = PWM_CHn_PDMR_Periodic;
    CounterModeStruct.PWM_CHn_TCMR = PWM_CHn_TCMR_RisingCounterMode;

    PWM_CounterModeInit(PWM_CH0, &CounterModeStruct);

    /* PWM interrupt configuration */
    PWM_IntConfig(PWM_CH0, ENABLE);
    PWM_CHn_IntConfig(PWM_CH0, PWM_CHn_IER_MIE | PWM_CHn_IER_OIE, ENABLE);

    /* PWM channel 0 start */
    PWM_CHn_Start(PWM_CH0);

    while(1);
}
コード例 #2
0
ファイル: main.c プロジェクト: edwin-oetelaar/W7500P
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
    /*System clock configuration*/
    SystemInit();
    /* NVIC configuration */
    NVIC_Configuration();

    /* CPIO configuration */
    GPIO_Setting();

    /* Time base configuration */
    CounterModeStruct.PWM_CHn_MR = 10;
    CounterModeStruct.PWM_CHn_LR = 20;
    CounterModeStruct.PWM_CHn_UDMR = PWM_CHn_UDMR_UpCount;
    CounterModeStruct.PWM_CHn_PDMR = PWM_CHn_PDMR_Periodic;
    CounterModeStruct.PWM_CHn_TCMR = PWM_CHn_TCMR_RisingCounterMode;

    PWM_CounterModeInit(PWM_CH0, &CounterModeStruct);

    /* PWM interrupt configuration */
    PWM_IntConfig(PWM_CH0, ENABLE);
    PWM_CHn_IntConfig(PWM_CH0, PWM_CHn_IER_MIE | PWM_CHn_IER_OIE, ENABLE);

    /* PWM channel 0 start */
    PWM_CHn_Start(PWM_CH0);

    while(1);
}