本文整理汇总了C++中SysCtlDelay函数的典型用法代码示例。如果您正苦于以下问题:C++ SysCtlDelay函数的具体用法?C++ SysCtlDelay怎么用?C++ SysCtlDelay使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SysCtlDelay函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HibernateRTCMatch0Set
//*****************************************************************************
//
//! Sets the value of the RTC match 0 register.
//!
//! \param ulMatch is the value for the match register.
//!
//! Sets the match 0 register for the RTC. The Hibernation module can be
//! configured to wake from hibernation, and/or generate an interrupt when the
//! value of the RTC counter is the same as the match register.
//!
//! \return None.
//
//*****************************************************************************
void
HibernateRTCMatch0Set(unsigned long ulMatch)
{
//
// Write the new match value to the match register.
//
HWREG(HIB_RTCM0) = ulMatch;
//
// Add a delay here to enforce the required delay between write accesses to
// certain Hibernation module registers.
//
if(CLASS_IS_FURY)
{
//
// Delay a fixed time on Fury-class devices
//
SysCtlDelay(g_ulWriteDelay);
}
else
{
//
// Wait for write complete to be signaled on later devices.
//
HibernateWriteComplete();
}
}
示例2: temp_configSensorContinuousRead
/**
* Configures the temperature sensor for continuous read mode and reads the
* status register
* Utilizes SSI0
*
* \param statusreg - A pointer to store the status information that is read
**/
void temp_configSensorContinuousRead(uint32_t *statusreg) {
uint32_t commandWriteConfigReg = 0x00000C01;
uint32_t commandReadStatusReg = 0x00000040; // 0b01000000
uint32_t commandReadStatusEmpty = 0x00000000;
uint32_t trashBin[2];
// Setup Configuration Register (register address: 0x01
SSIDataPut(SSI0_BASE, commandWriteConfigReg);
SSIDataPut(SSI0_BASE, commandReadStatusEmpty);
// SysCtlDelay(4170000); // (3 cycles/loop) * (1/50MHz) * (4170000 loop cycles) = 250.2ms
// Read any residual data from the SSI port. This makes sure the receive
// FIFOs are empty, so we don't read any unwanted junk. This is done here
// because the SPI SSI mode is full-duplex, which allows you to send and
// receive at the same time. The SSIDataGetNonBlocking function returns
// "true" when data was returned, and "false" when no data was returned.
// The "non-blocking" function checks if there is any data in the receive
// FIFO and does not "hang" if there isn't.
while(SSIDataGetNonBlocking(SSI0_BASE, &trashBin[0]))
{
}
// Read status register (Address: 0x0)
SSIDataPut(SSI0_BASE, commandReadStatusReg);
SSIDataGet(SSI0_BASE, &trashBin[1]);
SSIDataPut(SSI0_BASE, commandReadStatusEmpty);
SSIDataGet(SSI0_BASE, statusreg);
//Need to adjust for different processor frequencies
SysCtlDelay(4170000); // (3 cycles/loop) * (1/50MHz) * (4170000 loop cycles) = 250.2ms
}
示例3: UTUtilsDelayCycles
void
UTUtilsDelayCycles(unsigned long ulTimeoutCycles)
{
//
// Call the assembler delay function to spin uselessly for the desired
// period of time.
//
#ifdef ENABLE_PREFETCH
SysCtlDelay((ulTimeoutCycles * PREFETCH_FUDGE_NUM)/
(DELAY_LOOP_INSTRUCTIONS * PREFETCH_FUDGE_DEN));
#else
SysCtlDelay(ulTimeoutCycles / DELAY_LOOP_INSTRUCTIONS);
#endif
return;
}
示例4: uartprinntf
void uartprinntf()
{
//
// Initionalize system clock.
//
xSysCtlPeripheralClockSourceSet( 10000000, xSYSCTL_XTAL_6MHZ );
SysCtlDelay(10000);
xSPinTypeUART(UART0RX,PB0);
xSPinTypeUART(UART0TX,PB1);
xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART_S_EXT12M);
//
// Config 8 bit word length, 1 stop bit,
// and none parity bit, receive FIFO 1 byte.
//
UARTConfigSetExpClk(UART0_BASE, 115200, (UART_CONFIG_WLEN_8 |
UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
UARTEnable(UART0_BASE, (UART_BLOCK_UART | UART_BLOCK_TX | UART_BLOCK_RX));
UARTBufferWrite(UART0_BASE, "NUC1xx.UART.BAUDRATE EXAMPLE \r\n", sizeof("NUC1xx.UART.BAUDRATE EXAMPLE \r\n"));
}
示例5: SampleLightCO
void SampleLightCO(void){
unsigned long ulADC0_Value[1];
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | ADC_CTL_IE |
ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 3);
ADCIntClear(ADC0_BASE, 3);
while(1){
ADCProcessorTrigger(ADC0_BASE, 3);
while(!ADCIntStatus(ADC0_BASE, 3, false)){
}
ADCIntClear(ADC0_BASE, 3);
ADCSequenceDataGet(ADC0_BASE, 3, ulADC0_Value);
Log("Breath Level = ");
LogD(ulADC0_Value[0]);
Log("\r");
SysCtlDelay(SysCtlClockGet() / 12);
}
}
示例6: Display96x16x1WriteByte
//*****************************************************************************
//
//! \internal
//!
//! Write a byte to the SSD0303 or SSD1300 controller.
//!
//! \param ucChar is the byte to be transmitted to the controller.
//!
//! This function continues a transfer to the display controller by writing
//! another byte over the I2C bus. This must only be called after calling
//! Display96x16x1WriteFirst(), but before calling Display96x16x1WriteFinal().
//!
//! The data is written in a polled faashion; this function will not return
//! until the byte has been written to the controller.
//!
//! \return None.
//
//*****************************************************************************
static void
Display96x16x1WriteByte(uint8_t ucChar)
{
//
// Wait until the current byte has been transferred.
//
while(I2C0_MASTER->MRIS == 0)
{
}
//
// Provide the required inter-byte delay.
//
SysCtlDelay(g_ulDelay);
//
// Write the next byte to the controller.
//
I2C0_MASTER->MDR = ucChar;
//
// Continue the transfer.
//
I2C0_MASTER->MCS = I2C_MASTER_CMD_BURST_SEND_CONT;
}
示例7: Display96x16x1WriteArray
//*****************************************************************************
//
//! \internal
//!
//! Write a sequence of bytes to the SSD0303 or SD1300 controller.
//!
//! This function continues a transfer to the display controller by writing a
//! sequence of bytes over the I2C bus. This must only be called after calling
//! Display96x16x1WriteFirst(), but before calling Display96x16x1WriteFinal().
//!
//! The data is written in a polled fashion; this function will not return
//! until the entire byte sequence has been written to the controller.
//!
//! \return None.
//
//*****************************************************************************
static void
Display96x16x1WriteArray(uint8_t const *pucBuffer, uint32_t ulCount)
{
//
// Loop while there are more bytes left to be transferred.
//
while(ulCount != 0)
{
//
// Wait until the current byte has been transferred.
//
while(I2C0_MASTER->MRIS == 0)
{
}
//
// Provide the required inter-byte delay.
//
SysCtlDelay(g_ulDelay);
//
// Write the next byte to the controller.
//
I2C0_MASTER->MDR = *pucBuffer++;
ulCount--;
//
// Continue the transfer.
//
I2C0_MASTER->MCS = I2C_MASTER_CMD_BURST_SEND_CONT;
}
}
示例8: BPMTimerSetUp
void BPMTimerSetUp()
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); // timer 0
SysCtlDelay(3);
//
// Enable processor interrupts.
//
//IntPrioritySet(INT_TIMER0A_TM4C123, 2);
//
// Configure the two 32-bit periodic timers.
//
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet()/500);
//ROM_SysCtlClockGet()/100000
//ROM_SysCtlClockGet()/500
// Setup the interrupts for the timer timeouts.
ROM_IntEnable(INT_TIMER0A);
ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
//
// Enable the timers.
//
ROM_TimerEnable(TIMER0_BASE, TIMER_A);
}
示例9: main
int main(void) {
SysCtlClockSet(
SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
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);
ADCSequenceDisable(ADC0_BASE, 1);
ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 3,
ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 1);
UARTprintf("This is ADC examlpe");
while (1) {
UARTprintf("Temperature is: %d \210 C\n", ADC_getVal());
SysCtlDelay(40000000 / 3);
}
}
示例10: main
int main(void) {
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_SYSDIV_5| SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE,1,3,ADC_CTL_TS|ADC_CTL_IE|ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 1);
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
ledPinConfig();
while (1)
{
Test2();
//print_temc();
SysCtlDelay(SysCtlClockGet()/3);
}
}
示例11: main
int main(void)
{
unsigned char i;
xSysCtlClockSet(16000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);
// xSysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);
SensorShieldInit();
SensorShieldIOInit();
xGPIOSPinDirModeSet(SENSOR_SHIELD_I0, xGPIO_DIR_MODE_IN);
xGPIOSPinDirModeSet(SENSOR_SHIELD_I1, xGPIO_DIR_MODE_IN);
xGPIOSPinDirModeSet(SENSOR_SHIELD_I2, xGPIO_DIR_MODE_IN);
xGPIOSPinIntEnable(SENSOR_SHIELD_I0, xGPIO_RISING_EDGE);
xGPIOSPinIntEnable(SENSOR_SHIELD_I1, xGPIO_RISING_EDGE);
xGPIOSPinIntEnable(SENSOR_SHIELD_I2, xGPIO_RISING_EDGE);
xGPIOSPinIntCallbackInit(SENSOR_SHIELD_I0, Key1Callback);
xGPIOSPinIntCallbackInit(SENSOR_SHIELD_I1, Key2Callback);
xGPIOSPinIntCallbackInit(SENSOR_SHIELD_I2, Key3Callback);
xIntEnable(xINT_GPIOB);
xIntEnable(xINT_GPIOB);
SensorShieldOutWrite(SENSOR_SHIELD_O0, 1);
SensorShieldOutWrite(SENSOR_SHIELD_O1, 1);
SensorShieldOutWrite(SENSOR_SHIELD_O2, 1);
SensorShieldOutWrite(SENSOR_SHIELD_O3, 1);
SensorShieldOutWrite(SENSOR_SHIELD_O4, 1);
SensorShieldOutWrite(SENSOR_SHIELD_O5, 1);
while(1)
{
if(key2)
{
key2 = 0;
for(i=0;i<10;i++){
SensorShieldOutWrite(SENSOR_SHIELD_O0, 1);
SensorShieldOutWrite(SENSOR_SHIELD_O1, 1);
SensorShieldOutWrite(SENSOR_SHIELD_O2, 1);
SysCtlDelay(1000000);
SensorShieldOutWrite(SENSOR_SHIELD_O0, 0);
SensorShieldOutWrite(SENSOR_SHIELD_O1, 0);
SensorShieldOutWrite(SENSOR_SHIELD_O2, 0);
SysCtlDelay(1000000);
}
}
}
}
示例12: _EncoderInit
void _EncoderInit(){
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_QEI0);
SysCtlDelay(1);
HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
HWREG(GPIO_PORTD_BASE + GPIO_O_CR) |= 0x80;
//Set Pins to be PHA0 and PHB0
GPIOPinConfigure(GPIO_PD6_PHA0);
GPIOPinConfigure(GPIO_PD7_PHB0);
GPIOPinTypeQEI(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7);
QEIDisable(QEI0_BASE);
QEIIntDisable(QEI0_BASE,QEI_INTERROR | QEI_INTDIR | QEI_INTTIMER | QEI_INTINDEX);
QEIConfigure(QEI0_BASE, (QEI_CONFIG_CAPTURE_A_B | QEI_CONFIG_NO_RESET | QEI_CONFIG_QUADRATURE | QEI_CONFIG_NO_SWAP), 1000);
QEIVelocityConfigure(QEI0_BASE, QEI_VELDIV_1,80000000/12);
QEIEnable(QEI0_BASE);
QEIVelocityEnable(QEI0_BASE);
//Set position to a middle value so we can see if things are working
QEIPositionSet(QEI0_BASE, 500);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_QEI1);
SysCtlDelay(1);
//Set Pins to be PHA0 and PHB0
GPIOPinConfigure(GPIO_PC5_PHA1);
GPIOPinConfigure(GPIO_PC6_PHB1);
GPIOPinTypeQEI(GPIO_PORTC_BASE, GPIO_PIN_5 | GPIO_PIN_6);
QEIDisable(QEI1_BASE);
QEIIntDisable(QEI1_BASE,QEI_INTERROR | QEI_INTDIR | QEI_INTTIMER | QEI_INTINDEX);
QEIConfigure(QEI1_BASE, (QEI_CONFIG_CAPTURE_A_B | QEI_CONFIG_NO_RESET | QEI_CONFIG_QUADRATURE | QEI_CONFIG_SWAP), 1000);
QEIVelocityConfigure(QEI1_BASE, QEI_VELDIV_1,80000000/12);
QEIEnable(QEI1_BASE);
QEIVelocityEnable(QEI1_BASE);
//Set position to a middle value so we can see if things are working
QEIPositionSet(QEI1_BASE, 500);
}
示例13: ConfigureUSBInterface
//*****************************************************************************
//
// Configure the USB controller and power the bus.
//
// This function configures the USB controller for host operation.
// It is assumed that the main system clock has been configured at this point.
//
// \return None.
//
//*****************************************************************************
void
ConfigureUSBInterface(void)
{
//
// Enable the uDMA controller and set up the control table base.
// This is required by usblib.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
uDMAEnable();
uDMAControlBaseSet(g_sDMAControlTable);
//
// Enable the USB controller.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
//
// Set the USB pins to be controlled by the USB controller.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN);
ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Register the host class driver
//
USBHCDRegisterDrivers(0, g_ppHostClassDrivers, NUM_CLASS_DRIVERS);
//
// Open an instance of the mass storage class driver.
//
g_psMSCInstance = USBHMSCDriveOpen(0, MSCCallback);
//
// Initialize the power configuration. This sets the power enable signal
// to be active high and does not enable the power fault.
//
USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER);
//
// Force the USB mode to host with no callback on mode changes since
// there should not be any.
//
USBStackModeSet(0, eUSBModeForceHost, 0);
//
// Wait 10ms for the pin to go low.
//
SysCtlDelay(SysCtlClockGet()/100);
//
// Initialize the host controller.
//
USBHCDInit(0, g_pHCDPool, HCD_MEMORY_SIZE);
}
示例14: getDistance
int getDistance()
{
int i,j;
float lat_proper; //These store the properly formatted lat/longs in decimal.
float long_proper;
LCDWriteText("Locating... ", 0, 0);
LCDWriteText(" ", 1, 0);
#ifdef EASYOPEN //Untested, should work.
int open=true;
for(int i=0;i<3000;i++)
{
if (GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0)!=0) {open = false;}
}
if (open == true) {return 0;}
#endif
for (i = 0;i<TIMEOUT;i++) //for TIMEOUT seconds of trying
{
if (haveFix == 1)
{
//This should all work - the values given are reasonable, but needs to be tested outside.
lat_proper = 10*(latitude[0]-ATD)+latitude[1]-ATD;
lat_proper += ((float)(10*(latitude[2]-ATD) + latitude[3]-ATD))/60.0;
long_proper = 10*(longitude[1]-ATD)+longitude[2]-ATD;
long_proper += ((float)(10*(longitude[3]-ATD)+longitude[4]-ATD))/60.0;
for (j=0;j<5;j++)
{
lat_proper += ((float)(latitude[5+j]-ATD) /(600.0 * (float)(10^j)));
long_proper += ((float)(longitude[6+j]-ATD) /(600.0 * (float)(10^j)));
}
if (neglat){lat_proper = -lat_proper;}
if (neglong){long_proper = -long_proper;}
double dlat1=lat_proper*(M_PI/180);
double dlong1=long_proper*(M_PI/180);
double dlat2 = FINALLAT * (M_PI/180);
double dlong2= FINALLONG * (M_PI/180);
double dLong=dlong1-dlong2;
double dLat=dlat1-dlat2;
double aHarv= pow(sin(dLat/2.0),2.0) + cos(dlat1)*cos(dlat2)*pow(sin(dLong/2),2);
double cHarv=2*atan2(sqrt(aHarv),sqrt(1.0-aHarv));
//double distance=EARTHRADIUS*cHarv;
haveFix = 0;
return (int)(EARTHRADIUS*cHarv*1000); //whatever, need to get correct distance here.
}
SysCtlDelay(SysCtlClockGet()/3);
}
//if got fix, return distance.
//else, return 99999 to signal couldn't fix so no penalty
return 99999;
}
示例15: pause
void pause (unsigned int amount)
{
/*
static unsigned int fudge_factor = 0 ;
unsigned long ul ;
*/
SysCtlDelay(SysCtlClockGet() / (1000 * 3));
}