本文整理汇总了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);
}
}
示例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);
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例8: systick_init
void systick_init(void) {
// 1 ms period
SysTickPeriodSet(8000);
SysTickIntEnable();
SysTickIntRegister(schedule);
SysTickEnable();
}
示例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;
}
}
示例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();
}
示例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) {
}
}
示例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);
}
示例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;
}
示例14: SystickInit
void SystickInit(uint8_t report)
{
//启动系统计时器
//1us一次systick中断
SysTickPeriodSet(SysCtlClockGet());
SysTickEnable();
}
示例15: SysTickPeriodSet
void Timer::init() {
*(portNVIC_SYSPRI2) |= portNVIC_SYSTICK_PRI;
SysTickPeriodSet((SysCtlClockGet() * Timer::microsecondsInterval) / 1000000);
microTimeInterval=Timer::microsecondsInterval;
SysTickIntEnable();
}