当前位置: 首页>>代码示例>>C++>>正文


C++ SysTickPeriodSet函数代码示例

本文整理汇总了C++中SysTickPeriodSet函数的典型用法代码示例。如果您正苦于以下问题:C++ SysTickPeriodSet函数的具体用法?C++ SysTickPeriodSet怎么用?C++ SysTickPeriodSet使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SysTickPeriodSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

//*****************************************************************************
//		GLOBAL DATA VARIABLES
//*****************************************************************************
int main(void)
{
	//
		// 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 the clocking to run directly from the crystal.
		//
		SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN| SYSCTL_XTAL_16MHZ);

		//
		// Set up and enable the SysTick timer.  It will be used as a reference
		// for delay loops in the interrupt handlers.  The SysTick timer period
		// will be set up for one second.
		//
		SysTickPeriodSet(SysCtlClockGet());
		SysTickEnable();

		GPIO_Initialize();

	while(1)
	{
		LED_ChangeColor(LED_BLUE);
		DelayMS(1);
		LED_ChangeColor(LED_RED);
		DelayMS(1);
	}

}
开发者ID:thrasher8390,项目名称:QuadRotorFirmware_TIVA,代码行数:36,代码来源:main.c

示例2: SysTickInit

//*****************************************************************************
//
//	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);

}
开发者ID:chinmay-ratnaparkhi,项目名称:EECS388-Embedded-Systems,代码行数:36,代码来源:PushButton.c

示例3: ConnectNetwork

int ConnectNetwork(Network* n, char* addr, int port)
{
	SlSockAddrIn_t sAddr;
	int addrSize;
	int retVal;
	unsigned long ipAddress;

	sl_NetAppDnsGetHostByName(addr, strlen(addr), &ipAddress, AF_INET);

	sAddr.sin_family = AF_INET;
	sAddr.sin_port = sl_Htons((unsigned short)port);
	sAddr.sin_addr.s_addr = sl_Htonl(ipAddress);

	addrSize = sizeof(SlSockAddrIn_t);

	n->my_socket = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
	if( n->my_socket < 0 ) {
		// error
		return -1;
	}

	retVal = sl_Connect(n->my_socket, ( SlSockAddr_t *)&sAddr, addrSize);
	if( retVal < 0 ) {
		// error
		sl_Close(n->my_socket);
	    return retVal;
	}

	SysTickIntRegister(SysTickIntHandler);
	SysTickPeriodSet(80000);
	SysTickEnable();

	return retVal;
}
开发者ID:yunba,项目名称:yunba-embedded-c-sdk,代码行数:34,代码来源:MQTTCC3200.c

示例4: hal_init

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();
}
开发者ID:saiyn,项目名称:OSAL,代码行数:26,代码来源:main.c

示例5: hw_init

void hw_init(void){
	SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

	f_cpu = SysCtlClockGet();
	SysTickPeriodSet(0xffffffff);
	SysTickEnable();
//	UARTStdioInit();

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	GPIODirModeSet(SONAR_PORT, TRIG_PIN, GPIO_DIR_MODE_OUT);
	GPIODirModeSet(SONAR_PORT, SERVO_PIN, GPIO_DIR_MODE_OUT);

	GPIOPinTypeGPIOInput(SONAR_PORT, ECHO_PIN);
	GPIOIntTypeSet(SONAR_PORT, ECHO_PIN, GPIO_RISING_EDGE);
	GPIOPinIntEnable(SONAR_PORT,ECHO_PIN);
	IntEnable(INT_GPIOD);

	//Timer configuration
	SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
	TimerConfigure(TIMER0_BASE, TIMER_CFG_A_PERIODIC);
	const long timer_match = (f_cpu/1000000)*10;
	const long timer_out = (f_cpu/1000)*80;
	TimerLoadSet(TIMER0_BASE, TIMER_A, timer_out);
	TimerMatchSet(TIMER0_BASE, TIMER_A, timer_match);
	TimerEnable(TIMER0_BASE, TIMER_A);
	TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
	TimerIntClear(TIMER0_BASE,TIMER_A);
	IntEnable(INT_TIMER0A);

	IntMasterEnable();

}
开发者ID:gluker,项目名称:sonar,代码行数:32,代码来源:main.c

示例6: FPUEnable

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();
}
开发者ID:vortex314,项目名称:projects,代码行数:60,代码来源:Board.cpp

示例7: rt_hw_board_init

/**
 * 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();
}
开发者ID:304471720,项目名称:rt-thread,代码行数:35,代码来源:board.c

示例8: systick_init

void systick_init(void) {
    // 1 ms period
    SysTickPeriodSet(8000);
    SysTickIntEnable();
    SysTickIntRegister(schedule);
    SysTickEnable();
}
开发者ID:CptSpaceToaster,项目名称:EGR424_potatOS,代码行数:7,代码来源:main.c

示例9: mRTCInit

// **********************************************
// 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;
	}
}
开发者ID:msteinke,项目名称:helicopter_RTP_controller,代码行数:29,代码来源:mRTC.c

示例10: BSP_init

//*****************************************************************************
//
// 板级开发包初始化
//
//*****************************************************************************
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();
}
开发者ID:redfox-qu,项目名称:ipmi_ucos_6911,代码行数:37,代码来源:main.c

示例11: OS_Launch

// ******* 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) {
  }
}
开发者ID:tach4455,项目名称:EE345M,代码行数:36,代码来源:OS.c

示例12: SysTickInit

//*****************************************************************************
//
//! 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);
}
开发者ID:Balu1991,项目名称:Wifly_Light,代码行数:37,代码来源:systick_if.c

示例13: OS_Suspend

// ******** OS_Suspend ************
// suspend execution of currently running thread
// scheduler will choose another thread to execute
// Can be used to implement cooperative multitasking
// Same function as OS_Sleep(0)
// input:  none
// output: none
void OS_Suspend(void) {

  long curPriority;
  unsigned long curTimeSlice;
  volatile int i;

  OS_DisableInterrupts();

  // Determines NextPt
  Scheduler();

  // Get priority of next thread and calculate timeslice
  curPriority = (*NextPt).priority;
  curTimeSlice = calcTimeSlice(curPriority);

  // Sets next systick period, does not rest counting
  SysTickPeriodSet(curTimeSlice);

  // Write to register forces systick to reset counting
  NVIC_ST_CURRENT_R = 0;

  IntPendSet(FAULT_PENDSV);
  OS_EnableInterrupts();

  return;
}
开发者ID:tach4455,项目名称:EE345M,代码行数:33,代码来源:OS.c

示例14: SystickInit

void SystickInit(uint8_t report)
{
	//启动系统计时器
	//1us一次systick中断
	SysTickPeriodSet(SysCtlClockGet());
	SysTickEnable();
}
开发者ID:hosea1008,项目名称:Tiva_Quadrotor,代码行数:7,代码来源:Initial.c

示例15: SysTickPeriodSet

void Timer::init() {

	*(portNVIC_SYSPRI2) |= portNVIC_SYSTICK_PRI;
	SysTickPeriodSet((SysCtlClockGet() * Timer::microsecondsInterval) / 1000000);
	microTimeInterval=Timer::microsecondsInterval;
        SysTickIntEnable();
}
开发者ID:art1,项目名称:FloatSat-Project-G9,代码行数:7,代码来源:hw_specific.cpp


注:本文中的SysTickPeriodSet函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。