void systick_init(void) { // 1 ms period SysTickPeriodSet(8000); SysTickIntEnable(); SysTickIntRegister(schedule); SysTickEnable(); }
static void hal_init(void) { gSysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); //gSysClock = SysCtlClockFreqSet((SYSCTL_OSC_INT | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_320), 120000000); //SysCtlDeepSleep(); /*systick = 1ms*/ SysTickPeriodSet(gSysClock / 1000); SysTickEnable(); SysTickIntEnable(); bsp_gpio_init(); uart_hal_init(); bsp_adc_init(); bsp_spi0_init(); bsp_timer0_init(); bsp_timer1_init(); bsp_bt_uart_init(); bsp_nad_app_uart_init(); //bsp_pwm1_init(); IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY); IntMasterEnable(); }
//***************************************************************************** // //! Initializes the user interface. //! //! This function initializes the user interface modules (ethernet), //! preparing them to operate. //! //! \return None. // //***************************************************************************** void UIInit(void) { // // Initialize the UART. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTStdioInit(0); UARTprintf("\033[2JEK-LM3S9B92 Plane-Power control board\n"); // // Initialize the Ethernet user interface. Use DHCP // UIEthernetInit( true ); // // Configure SysTick to provide a periodic user interface interrupt. // SysTickPeriodSet( ROM_SysCtlClockGet() / UI_INT_RATE ); SysTickIntEnable(); SysTickEnable(); }
//***************************************************************************** // //! SysTick Initialization //! //! \param None //! //! \return None //! //***************************************************************************** tBoolean SysTickInit(void) { // // Query the current system clock rate. // g_ulClockRate = 80000000; // // Set up for the system tick calculations. We keep copies of the number // of milliseconds per cycle and the rounding error to prevent the need // to perform these calculations on every interrupt (the macros are not // merely static values). // g_ulSysTickCount = 0; g_ulSysTickMs = SYSTICK_RELOAD_MS; g_ulSysTickRounding = SYSTICK_CYCLE_ROUNDING; // // Set up the system tick to run and interrupt when it times out. // SysTickIntEnable(); SysTickPeriodSet(SYSTICK_RELOAD_VALUE); SysTickEnable(); return(true); }
void SysTick::enableInterrupts(void) { InterruptHandler::getInstance().setInterruptHandler(this); // Enable SysTick interrupts SysTickIntEnable(); }
// ******* OS_Launch ********************* // start the scheduler, enable interrupts // Inputs: number of 20ns clock cycles for each time slice // ( Maximum of 24 bits) // Outputs: none (does not return) void OS_Launch(unsigned long theTimeSlice) { long curPriority; unsigned long curTimeSlice; gTimeSlice = theTimeSlice; // Get priority of next thread curPriority = (*RunPt).priority; // Calculate timeslice for priority of next thread curTimeSlice = calcTimeSlice(curPriority); SysTickPeriodSet(curTimeSlice); // Enable sleeping decrementer TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT); TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT); TimerEnable(TIMER1_BASE, TIMER_A); IntEnable(INT_TIMER1A); // Enable and reset Systick SysTickEnable(); SysTickIntEnable(); NVIC_ST_CURRENT_R = 0; IntEnable(FAULT_SYSTICK); StartOS(); // Assembly language function that initilizes stack for running while(1) { } }
//***************************************************************************** // // 板级开发包初始化 // //***************************************************************************** void BSP_init(void) { // Set the clocking to run directly from the crystal. SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // Enable processor interrupts. IntMasterEnable(); // Configure SysTick for a periodic interrupt. SysTickPeriodSet(SysCtlClockGet() / SYSTICKHZ); SysTickEnable(); SysTickIntEnable(); // Initialize the DEBUG UART. (UART0) DEBUG_UART_init(); // Initialize the IO Hardware. (LED/SOL/I2C_HOTSWAP) IO_init(); // Initialize the UART Hardware. (ICMB/SOL) UART_init(); // Initialize the SPI Hardware. (SSIF) SPI_init(); // Initialize the I2C Hardware. (IPMB/PMB) I2C_init(); // Initialize the Ethernet Hardware. (LAN) ETH_init(); }
void Timer::init() { *(portNVIC_SYSPRI2) |= portNVIC_SYSTICK_PRI; SysTickPeriodSet((SysCtlClockGet() * Timer::microsecondsInterval) / 1000000); microTimeInterval=Timer::microsecondsInterval; SysTickIntEnable(); }
//***************************************************************************** // // Initializes the hardware's system clock and the SysTick Interrupt // //***************************************************************************** void SysTickInit() { // // Set the clocking to run directly from the crystal. // SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // // Get the system clock speed. // systemClock = SysCtlClockGet(); // // Configure SysTick interrupts // SysTickPeriodSet(systemClock / SYSTICK_FREQUENCY); SysTickIntEnable(); SysTickEnable(); // // Code to cause a wait for a "Select Button" press // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_7); RIT128x96x4Init(1000000); RIT128x96x4StringDraw("Press \"Select\" Button", 0, 24, 15); RIT128x96x4StringDraw("To Continue", 32, 32, 15); while(GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_7)); SysCtlPeripheralDisable(SYSCTL_PERIPH_GPIOG); SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOG); }
void Board::init() // initialize the board specifics { // // Enable lazy stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. // FPUEnable(); FPULazyStackingEnable(); // // Set the clocking to run from the PLL at 50MHz // ROM_SysCtlClockSet( SYSCTL_SYSDIV_1 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); IntMasterEnable(); // Enable interrupts to the processor. // Set up the period for the SysTick timer for 1 mS. SysTickPeriodSet(SysCtlClockGet() / 1000); SysTickIntEnable(); // Enable the SysTick Interrupt. SysTickEnable(); // Enable SysTick. /* // // Enable lazy stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. FPUEnable(); FPULazyStackingEnable(); SysCtlClockSet( SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // Set the clocking to run directly from the crystal. IntMasterEnable(); // Enable interrupts to the processor.*/ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // Enable the GPIO port that is used for the on-board LED. GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); // Enable the GPIO pins for the LED (PF2). GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3); /* SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // Enable the peripherals used by this example. SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); IntMasterEnable(); // Enable processor interrupts. // Set up the period for the SysTick timer for 1 mS. SysTickPeriodSet(SysCtlClockGet() / 1000); SysTickIntEnable(); // Enable the SysTick Interrupt. SysTickEnable(); // Enable SysTick. GPIOPinConfigure(GPIO_PA0_U0RX); // Set GPIO A0 and A1 as UART pins. GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // Configure the UART for 115,200, 8-N-1 operation. IntEnable(INT_UART0); UARTFIFODisable(UART0_BASE); // UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX1_8, UART_FIFO_RX1_8); UARTFlowControlSet(UART0_BASE, UART_FLOWCONTROL_NONE); UARTIntDisable(UART0_BASE, UART_INT_RT); UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_TX); // Enable the UART interrupt.*/ Board::setLedOn(Board::LED_GREEN, false); Board::setLedOn(Board::LED_RED, false); Board::setLedOn(Board::LED_BLUE, false); AdcInit(); }
/** * This function will initial LM3S board. */ void rt_hw_board_init() { // // Enable lazy stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. // FPULazyStackingEnable(); // set sysclock to 80M SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); /* init systick */ SysTickDisable(); SysTickPeriodSet(SysCtlClockGet()/RT_TICK_PER_SECOND); SysTickIntEnable(); SysTickEnable(); /* enable ssio */ //SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); #if LM3S_EXT_SRAM == 1 /* init SDRAM */ rt_hw_sdram_init(); #endif /* init console */ rt_hw_console_init(); /* enable interrupt */ IntMasterEnable(); }
// ********************************************** // Initializes the real-time clock (systick). void mRTCInit(unsigned short rtc_rate_given) { g_uiRTCRateHz = rtc_rate_given; clockInit(); SysTickPeriodSet(SysCtlClockGet() / g_uiRTCRateHz); //SysTickPeriodSet((SysTickPeriodGet()/4294967296) / (SYSTICK_RATE)); // // Reset real time clock g_ullRTCTicks = 0; // // Register the interrupt handler SysTickIntRegister(SysTickISR); // // Enable interrupt and device SysTickIntEnable(); SysTickEnable(); // clear the systick() task list. short i = 0; g_RTCNumTasks = 0; for (i = 0; i < SYSTICK_TASK_LIST_SIZE; i++) { g_RTCTaskList[i] = 0; } }
void SystickIntInit(){ //Enables Systick SysTickIntEnable(); //Registers the Systick interrupt handler SysTickIntRegister(SystickIntHandler); //Set the countdown time to about .1 ms SysTickPeriodSet(90000); }
//***************************************************************************** // // This is the main loop that runs the application. // //***************************************************************************** int main(void) { // // Set the clocking to run from the PLL at 50MHz. // SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); /* SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinConfigure(GPIO_PG4_USB0EPEN); GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); */ // // // Set the system tick to fire 100 times per second. // SysTickPeriodSet(SysCtlClockGet() / SYSTICKS_PER_SECOND); SysTickIntEnable(); SysTickEnable(); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // USBDHIDMouseInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); USBDHIDMouseRemoteWakeupRequest((void *)&g_sMouseDevice); // // Drop into the main loop. // while(1) { // // Wait for USB configuration to complete. // while(!g_bConnected) { } // // Now keep processing the mouse as long as the host is connected. // while(g_bConnected) { // // If it is time to move the mouse then do so. // if(HWREGBITW(&g_ulCommands, TICK_EVENT) == 1) { HWREGBITW(&g_ulCommands, TICK_EVENT) = 0; MoveHandler(); } } } }
/// User code entry point /// /// int main(void) { char adr, value; //int i = 0; // Initialize // ROM_SysCtlClockSet (SYSCTL_SYSDIV_1 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // 1ms SysTick SysTickPeriodSet(SysCtlClockGet() / 1000); SysTickIntEnable(); SysTickEnable(); // Serial console Launchpad_UART_Init(); // Booster pack BP_RFID_Init(); IntMasterEnable(); printf("[START]\n"); for (;;) { printf("> "); switch(UARTgetc()) { case 'c': adr = UARTgetc(); printf("[direct command 0x%02x]\n", adr); BP_RFID_TRF_Write_Command(adr); break; case 'w': adr = UARTgetc(); value = UARTgetc(); BP_RFID_TRF_Write_Register(adr, value); printf("[write 0x%02x < 0x%02x]\n"); break; case 'r': adr = UARTgetc(); printf("[read 0x%02x > 0x%02x]\n", adr, BP_RFID_TRF_Read_Register(adr)); break; case 'x': BP_ISO15693_Init(); break; case '\n': case '\r': break; default: printf("[unknown command]\n"); } } }
/************************************************************************************//** ** \brief Initializes the timer. ** \return none. ** ****************************************************************************************/ void TimeInit(void) { /* configure the SysTick timer for 1 ms period */ SysTickPeriodSet((unsigned long)SysCtlClockGet() / 1000); SysTickEnable(); SysTickIntEnable(); /* reset the millisecond counter */ TimeSet(0); } /*** end of TimeInit ***/
void TimerInit(void) { // // Set up and enable the SysTick timer. It will be used as a reference // for the delay loop. // SysTickPeriodSet(SysCtlClockGet()/TIMER_FREQ); SysTickEnable(); SysTickIntEnable(); }
/************************************************************************************************* * Initializes the system clock to run from the crystal * and enables the board's systick functionality. ************************************************************************************************/ void systemInit() { // Set the clocking to run directly from the crystal. SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // Configure and Enable SysTick mechanism SysTickPeriodSet(SysCtlClockGet() / SYSTICK_FREQUENCY); SysTickIntRegister(sysTickISR); SysTickIntEnable(); SysTickEnable(); }
int main(void) { //set clock SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); //PB1 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); GPIOPadConfigSet(GPIO_PORTB_BASE,GPIO_PIN_1,GPIO_STRENGTH_4MA,GPIO_PIN_TYPE_STD); GPIODirModeSet(GPIO_PORTB_BASE,GPIO_PIN_1,GPIO_DIR_MODE_IN); GPIOPortIntRegister(GPIO_PORTB_BASE, PortBIntHandler); GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_BOTH_EDGES); GPIOPinIntEnable(GPIO_PORTB_BASE, GPIO_PIN_1); // Status SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_2,GPIO_STRENGTH_4MA,GPIO_PIN_TYPE_STD); GPIODirModeSet(GPIO_PORTF_BASE,GPIO_PIN_2,GPIO_DIR_MODE_OUT); //UART SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 9600, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); IntEnable(INT_UART0); UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); IntPrioritySet(INT_UART0, 0x7F); IntPrioritySet(INT_GPIOB,0x80); IntMasterEnable(); SysTickIntRegister(SysTickHandler); SysTickPeriodSet(SysCtlClockGet()/10000); // 0.1ms SysTickIntEnable(); waitTime = 0; // initialize waitTime2 = 0; SysTickEnable(); while(1) { } }
//***************************************************************************** // // Init SysTick timer. // // //***************************************************************************** void InitSysTick(void) { // Configure SysTick to occur X times per second, to use as a time // reference. Enable SysTick to generate interrupts. // unsigned long debug = SysCtlClockGet(); SysTickPeriodSet(SysCtlClockGet()/SYSTICK_PER_MS); SysTickIntEnable(); SysTickEnable(); }
/********************************************************************* * @fn osalAdjustTimer * * @brief Updates the OSAL Clock and Timer with elapsed milliseconds. * * @param MSec - elapsed milliseconds * * @return none */ void osalAdjustTimer(uint32 Msec ) { /* Disable SysTick interrupts */ SysTickIntDisable(); osalClockUpdate(Msec); osalTimerUpdate(Msec); /* Enable SysTick interrupts */ SysTickIntEnable(); }
/*Function to handle Systick interrupts*/ void SysTickHandler(void) { SysTickIntDisable(); a1++; if(a1==100) { a1=1; disk_timerproc(); } SysTickIntEnable(); }
//**************************************************************************** // //! Initializes the task scheduler. //! //! \param ulTicksPerSecond sets the basic frequency of the SysTick interrupt //! used by the scheduler to determine when to run the various task functions. //! //! This function must be called during application startup to configure the //! SysTick timer. This is used by the scheduler module to determine when each //! of the functions provided in the g_psSchedulerTable array is called. //! //! The caller is responsible for ensuring that SchedulerSysTickIntHandler() //! has previously been installed in the SYSTICK vector in the vector table //! and must also ensure that interrupts are enabled at the CPU level. //! //! Note that this call does not start the scheduler calling the configured //! functions. All function calls are made in the context of later calls to //! SchedulerRun(). This call merely configures the SysTick interrupt that is //! used by the scheduler to determine what the current system time is. //! //! \return None. // //**************************************************************************** void SchedulerInit(unsigned long ulTicksPerSecond) { ASSERT(ulTicksPerSecond); // // Configure SysTick for a periodic interrupt. // SysTickPeriodSet(SysCtlClockGet() / ulTicksPerSecond); SysTickEnable(); SysTickIntEnable(); }
void cc32xx_init_timer(void) { static int init = 0; if (!init) { SysTickEnable(); SysTickIntEnable(); SysTickIntRegister(sysTickIntHandler); SysTickPeriodSet(MPU_FREQUENCY / 1000);/* 1 ms */ init = 1; } }
/* * Setup the systick timer to generate the tick interrupts at the required * frequency. */ void prvSetupTimerInterrupt( void ) { /* Configure SysTick to interrupt at the requested rate. */ // // Configure SysTick for a 100Hz interrupt. // wants a 10 ms tick. // SysTickPeriodSet(SysCtlClockGet() / 100); SysTickIntEnable(); SysTickEnable(); }
//***************************************************************************** // Initilizes hardware //***************************************************************************** void InitCortexHardware(void) { // // Enable FPU // FPUEnable(); FPULazyStackingEnable(); // Set clocking to 50 MHz, due to REV_A1 being a total ass. SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Configure UART0 for 115200-8n1 // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); UARTStdioConfig(0, 115200, 16000000); UARTFIFODisable(UART0_BASE); UARTIntEnable(UART0_BASE, UART_INT_RX); UARTprintf("\n\nSystem initializing.\n"); // // Enable SysTick for periodic Interrupts // systick is used by command line process // SysTickEnable(); SysTickPeriodSet(SysCtlClockGet()/(SYSTICK_TIME/10)); SysTickIntEnable(); UARTprintf("- Systick timer enabled.\n"); // // Configure Heartbeat led // SysCtlPeripheralEnable(HEARTBEAT_CTRL_PORT); GPIOPinTypeGPIOOutput(HEARTBEAT_BASE_PORT, HEARTBEAT_PIN); GPIOPinWrite(HEARTBEAT_BASE_PORT, HEARTBEAT_PIN, 0xFF); UARTprintf("- GPIO enabled. \n"); // // Enable UART interrupts // IntMasterEnable(); IntEnable(INT_UART0); UARTprintf("- Interrupts enabled.\n"); }
//***************************************************************************** // // Walking Robot // //***************************************************************************** int main(void) { // // Set the clocking to run directly from the crystal. // //Caution! All current settings depend from 6MHz frqequency of clocking!!! SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ); /*=============================SysTick===================================*/ SysTickPeriodSet( SysCtlClockGet() / WR_SYS_TIMER_FREQUENCY ); IntPrioritySet( FAULT_SYSTICK, 0 ); SysTickIntEnable(); SysTickEnable(); /*=======================================================================*/ /*=============================USER CODE=================================*/ WRPWMInit(); WRTimerInit(); WRFlashInit(); WRServInit(); WRLegInit(); WRUART0Init(); WRUART1Init(); WRConsoleInit(); SonarInit(); /*=======================================================================*/ /*===============================OLED====================================*/ // // Initialize the OLED display and write status. // // Display96x16x1Init(false); /*=======================================================================*/ while(1) { if (GetStatus()==3) WRSendDistance(GetDistFromSonar()); //=================blink========================== //================================================ } }
// Main void main(void) { mainSetup(); IntMasterEnable(); GPIOIntRegister(GPIO_PORTJ_BASE, interruptHandler); GPIOIntTypeSet(GPIO_PORTJ_BASE, GPIO_PIN_0, GPIO_FALLING_EDGE); GPIOIntEnable(GPIO_PORTJ_BASE, GPIO_PIN_0); //GPIOIntTypeSet(GPIO_PORTJ_BASE, GPIO_PIN_1, GPIO_FALLING_EDGE); //GPIOIntEnable(GPIO_PORTJ_BASE, GPIO_PIN_1); SysTickEnable(); SysTickPeriodSet(currentFreq); SysTickIntRegister(timerstep); SysTickIntEnable(); while (true); }
int main(void) { // Set the system clock to the full 120MHz uint32_t sysClkFreq = SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 120000000); debug_init(sysClkFreq); status_led_init(); network_driver_init(sysClkFreq); networking_init(); telemetry_init(); transducer_init(); thermocouple_init(); solenoid_init(); debug_print("Initialization complete. starting main loop.\r\n"); // Set up the SysTick timer and its interrupts SysTickPeriodSet(6000); // 40 kHz SysTickIntRegister(sys_tick); SysTickIntEnable(); SysTickEnable(); uint32_t loopIterations = 0; uint32_t frame_start = systick_clock; while(1) { status_led_periodic(); network_driver_periodic(); telemetry_periodic(); solenoid_periodic(); // debug_print_u32(systick_clock); //count loop iterations per second loopIterations++; if(systick_clock - frame_start >= 1000) { loops_per_second = loopIterations; loopIterations = 0; frame_start = systick_clock; } } }
/* This function is to initialize the SysTick relate configurations */ void BSP_SysTickInit() { #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */ OS_CPU_SR cpu_sr; #endif OS_ENTER_CRITICAL(); SysTickIntDisable(); SysTickIntRegister(OSTimeTickIsr); SysTickPeriodSet(80000); SysTickIntEnable(); SysTickEnable(); OS_EXIT_CRITICAL(); SysTickOut = 0x01; SysTickLedOut = GPIO_LED_PIN1; }