void BSP_Init(void) { BSP_RCC_Init(); BSP_UART_Init(); BSP_SW_Init(); BSP_ADC_Init(); BSP_LEDS_Init(); }
void BSP_Init (void) { BSP_IntInit(); /* Initialize Interrupts. */ BSP_REG_SIM_SCGC5 |= (SIM_SCGC5_PORTA_MASK /* Enable all the port Clocks */ | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK); /* Init System tick times. */ /* Clear pending interrupt. */ CPU_REG_NVIC_ST_RELOAD = (2000000UL); /* Set period. */ CPU_REG_NVIC_ST_CTRL |= SysTick_CSR_CLKSOURCE_MASK; /* Clock source - System Clock. */ CPU_REG_NVIC_ST_CTRL |= SysTick_CSR_TICKINT_MASK; /* Enable interrupt. */ CPU_REG_NVIC_ST_CTRL |= SysTick_CSR_ENABLE_MASK; /* Start Sys Timer. */ BSP_CPU_ClkFreq_MHz = BSP_CPU_ClkFreq() / (CPU_INT32U)1000000; BSP_CPU_ClkFreq_MHz = BSP_CPU_ClkFreq_MHz; /* Surpress compiler warning BSP_CPU_ClkFreq_MHz. */ BSP_PLL_Init(); BSP_LED_Init(); /* Initialize the I/Os for the LEDs. */ BSP_SW_Init(); /* Initialize the I/Os for the switches. */ BSP_TSI_Init(); /* Initialize the TSI module. */ BSP_IRC_Init(); /* Initialize the High-Speed Internal Reference Clock. */ #ifdef TRACE_EN /* See project / compiler preprocessor options. */ DBGMCU_CR |= DBGMCU_CR_TRACE_IOEN_MASK; /* Enable tracing (see Note #2). */ DBGMCU_CR &= ~DBGMCU_CR_TRACE_MODE_MASK; /* Clr trace mode sel bits. */ DBGMCU_CR |= DBGMCU_CR_TRACE_MODE_SYNC_04; /* Cfg trace mode to synch 4-bit. */ #endif }