这篇教程C++ ConfigureUART函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ConfigureUART函数的典型用法代码示例。如果您正苦于以下问题:C++ ConfigureUART函数的具体用法?C++ ConfigureUART怎么用?C++ ConfigureUART使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ConfigureUART函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: main//*****************************************************************************//// Print "Hello World!" to the UART on the Intelligent UART Module.////*****************************************************************************intmain(void){ // // Run from the PLL at 120 MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // // Configure the device pins. // PinoutSet(false, false); // // Enable the GPIO pins for the LED D1 (PN1). // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1); // // Initialize the UART. // ConfigureUART(); // // Hello! // UARTprintf("Hello, world!/n"); // // We are finished. Hang around flashing D1. // while(1) { // // Turn on D1. // LEDWrite(CLP_D1, 1); // // Delay for a bit. // SysCtlDelay(g_ui32SysClock / 10 / 3); // // Turn off D1. // LEDWrite(CLP_D1, 0); // // Delay for a bit. // SysCtlDelay(g_ui32SysClock / 10 / 3); }}
开发者ID:rikardonm,项目名称:tivaCCSv6,代码行数:61,
示例2: mainintmain(void) { // Run from the PLL at 120 MHz. g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), configCPU_CLOCK_HZ); // Initialize the device pinout appropriately for this board. pin_init(); // // Initialize the UART and write status. // ConfigureUART(); // Make sure the main oscillator is enabled because this is required by // the PHY. The system must have a 25MHz crystal attached to the OSC // pins. The SYSCTL_MOSC_HIGHFREQ parameter is used when the crystal // frequency is 10MHz or higher. SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ); // Create the LED task. if (LEDTaskInit() != 0) { while (1) { } } // Create the lwIP tasks. if (lwIPTaskInit() != 0) { while (1) { } } // Create the hello world task. /*if (hello_world_init() != 0) { while (1) { } }*/ UARTprintf("FreeRTOS + Lwip/n"); // Start the scheduler. This should not return. vTaskStartScheduler(); // In case the scheduler returns for some reason, loop forever. while (1) { }}
开发者ID:vinifr,项目名称:iot_tiva_template,代码行数:55,
示例3: mainextern "C" int main(void) { unsigned long ir_period; // 40 MHz system clock SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL| SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); ConfigureUART(); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Unlock PF0 so we can change it to a GPIO input // Once we have enabled (unlocked) the commit register then re-lock it // to prevent further changes. PF0 is muxed with NMI thus a special case. // HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01; HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0; // Interrupt on sw1 GPIODirModeSet(IR_PORT, IR_PIN, GPIO_DIR_MODE_IN); GPIOPadConfigSet(IR_PORT, IR_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); GPIOPinTypeGPIOInput(IR_PORT, IR_PIN); GPIOIntTypeSet(IR_PORT, IR_PIN, GPIO_FALLING_EDGE); GPIOIntRegister(IR_PORT, ir_input_isr); GPIOIntEnable(IR_PORT, IR_PIN ); IntMasterEnable(); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0); GPIOPinConfigure(GPIO_PF1_T0CCP1); GPIOPinTypeTimer(GPIO_PORTF_BASE, GPIO_PIN_1); // Configure timer ir_period = SysCtlClockGet() / (IR_CARRIER / 2); UARTprintf("ir_period:%d/n", ir_period); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR|TIMER_CFG_B_PWM); TimerLoadSet(TIMER0_BASE, TIMER_B, ir_period); TimerMatchSet(TIMER0_BASE, TIMER_B, ir_period / 2); // PWM TimerEnable(TIMER0_BASE, TIMER_B); unsigned long m = 0; while(1) { TimerMatchSet(TIMER0_BASE, TIMER_B, m++); // PWM if (m > ir_period) m = 0; int i = 0; while (i++ < 5000) if (!ir.empty()) UARTprintf("%u", ir.pop_front()); }}
开发者ID:royalbee,项目名称:ir-gadget,代码行数:55,
示例4: SysCtlPeripheralEnable//--------------------------------bool esp8266::Initialize() { pTheOneAndOnlyEsp8266 = this; // Setup the ESP8266 Reset Control Pin SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); GPIOPadConfigSet(GPIO_PORTC_BASE, GPIO_PIN_6, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); GPIODirModeSet(GPIO_PORTC_BASE, GPIO_PIN_6, GPIO_DIR_MODE_OUT); GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_6, 0); // ConfigureUART(115200); Reset(); return Setup();}
开发者ID:anol,项目名称:justscale,代码行数:14,
示例5: main// Main ----------------------------------------------------------------------------------------------int main(void){ // Enable lazy stacking ROM_FPULazyStackingEnable(); // Set the clocking to run directly from the crystal. ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // Initialize the UART and write status. ConfigureUART(); UARTprintf("Timers example/n"); // Enable LEDs ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN); // Enable the peripherals used by this example. ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2); // Enable processor interrupts. ROM_IntMasterEnable(); // Configure the two 32-bit periodic timers. ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); ROM_TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC); ROM_TimerConfigure(TIMER2_BASE, TIMER_CFG_PERIODIC); ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet()); ROM_TimerLoadSet(TIMER1_BASE, TIMER_A, ROM_SysCtlClockGet()*2); // Blue should blink 2 times as much as red ROM_TimerLoadSet(TIMER2_BASE, TIMER_A, ROM_SysCtlClockGet()*3); // Green should blink 3 times as much as red // Setup the interrupts for the timer timeouts. ROM_IntEnable(INT_TIMER0A); ROM_IntEnable(INT_TIMER1A); ROM_IntEnable(INT_TIMER2A); ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); ROM_TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT); ROM_TimerIntEnable(TIMER2_BASE, TIMER_TIMA_TIMEOUT); // Enable the timers. ROM_TimerEnable(TIMER0_BASE, TIMER_A); ROM_TimerEnable(TIMER1_BASE, TIMER_A); ROM_TimerEnable(TIMER2_BASE, TIMER_A); // Loop forever while the timers run. while(1){}}
开发者ID:chaitanya4b3,项目名称:Tiva-Test,代码行数:52,
示例6: main// Main ----------------------------------------------------------------------------------------------int main(void){ // Enable lazy stacking ROM_FPULazyStackingEnable(); // Set the system clock to run at 40Mhz off PLL with external crystal as reference. ROM_SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // Initialize the UART and write status. ConfigureUART(); UARTprintf("ISL29023 Example/n"); // Enable LEDs ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN); // Enable I2C3 ConfigureI2C3(); // Create struct tISL29023 islSensHub; // Create print variables uint32_t printValue[2]; ISL29023ChangeSettings(ISL29023_COMMANDII_RANGE64k, ISL29023_COMMANDII_RES16, &islSensHub); while(1){ // Get ALS ISL29023GetALS(&islSensHub); FloatToPrint(islSensHub.alsVal, printValue); UARTprintf("ALS: %d.%03d |.| ",printValue[0],printValue[1]); // Get IR ISL29023GetIR(&islSensHub); FloatToPrint(islSensHub.irVal, printValue); UARTprintf("IR: %d.%03d/n",printValue[0],printValue[1]); // Blink LED ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE, LED_GREEN); ROM_SysCtlDelay(ROM_SysCtlClockGet()/3/10); // Delay for 100ms (1/10s) :: ClockGet()/3 = 1second ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE, 0); // Delay for second ROM_SysCtlDelay(ROM_SysCtlClockGet()/3); }}
开发者ID:chaitanya4b3,项目名称:Tiva-Test,代码行数:49,
示例7: main// Main entry pointint main(void) { volatile uint32_t ui32Loop; // Set the clocking to run directly from the crystal. SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOF; ui32Loop = SYSCTL_RCGC2_R; GPIO_PORTF_DIR_R = 0x08; GPIO_PORTF_DEN_R = 0x08; ConfigureUART(); for (ui32Loop = 0; ui32Loop < 200000; ui32Loop++) { } //UARTprintf("AT+NAMEGloveKey"); UARTCharPut(UART1_BASE, 'f'); for (ui32Loop = 0; ui32Loop < 2000000; ui32Loop++) { } while(1) { UARTprintf("Hi Clark/r/n"); if (UARTCharsAvail(UART1_BASE)) { unsigned char temp = UARTgetc(); UARTCharPutNonBlocking(UART0_BASE, temp); } GPIO_PORTF_DATA_R |= 0x08; for (ui32Loop = 0; ui32Loop < 200000; ui32Loop++) { } GPIO_PORTF_DATA_R &= ~(0x08); for (ui32Loop = 0; ui32Loop < 200000; ui32Loop++) { } } return 0;}
开发者ID:ahliao,项目名称:HandKey_Tiva,代码行数:44,
示例8: main// Initialize FreeRTOS and start the initial set of tasks.int main(void){ // Set the clocking to run at 50 MHz from the PLL. ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // Initialize the UART and configure it for 115,200, 8-N-1 operation. ConfigureUART(); // Print demo introduction. UARTprintf("/n/nWelcome to the EK-TM4C123GXL FreeRTOS Demo!/n"); // Create the LED1 task. if(LED1TaskInit() != 0) { while(1) { } } // Create the LED2 task. if(LED2TaskInit() != 0) { while(1) { } } // Start the scheduler. This should not return. vTaskStartScheduler(); // In case the scheduler returns for some reason, print an error and loop forever. UARTprintf("/n/nScheduler error!/n"); while(1) { }}
开发者ID:rohitdureja,项目名称:freeRTOS-Launchpad-Demo,代码行数:41,
示例9: mainintmain(void){ // // Set the clocking to run at 50 MHz from the PLL. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // // Initialize the UART and configure it for 115,200, 8-N-1 operation. // ConfigureUART(); // // Print demo introduction. // Global_Queue_Handle=xQueueCreate(3,sizeof(int)); UARTprintf("/n/nWelcome to the EK-TM4C123GXL FreeRTOS Demo!/n"); //xTaskCreate(my_task2, (signed portCHAR *)"my_task2", 1024, NULL,1,NULL); xTaskCreate(my_task1, (signed portCHAR *)"my_task1", 1024, NULL,1,NULL); // // Start the scheduler. This should not return. // vTaskStartScheduler(); // // In case the scheduler returns for some reason, print an error and loop // forever. // while(1) { UARTprintf("Out of control by vTaskStartScheduler/n"); }}
开发者ID:SteveHuang27,项目名称:freertos_t00,代码行数:39,
示例10: UserRunvoid UserRun(void){#if defined(DEBUG) if(GetChannelMode(16)!=IS_UART_TX){ setMode(16,IS_UART_TX); ConfigureUART(115200); }#endif#if defined(WPIRBE) SPISlaveServer();#endif#if defined(USE_AS_LIBRARY) RunUserCode();#endif// if (Get_UART_Byte_CountPassThrough()>0){// PushSerial();// } if (RunEvery(&block0)>0.0f){ //println_W("Loop ");p_fl_W(getMs()/1000); }}
开发者ID:NeuronRobotics,项目名称:dyio,代码行数:23,
示例11: main//*****************************************************************************//// This is the main example program. It checks to see that the interrupts are// processed in the correct order when they have identical priorities,// increasing priorities, and decreasing priorities. This exercises interrupt// preemption and tail chaining.////*****************************************************************************intmain(void){ uint32_t ui32Error; // // 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. // ROM_FPULazyStackingEnable(); // // Set the clocking to run directly from the crystal. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable the peripherals used by this example. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); // // Initialize the UART. // ConfigureUART(); UARTprintf("/033[2JInterrupts/n"); // // Configure the PB0-PB2 to be outputs to indicate entry/exit of one // of the interrupt handlers. // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3); ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, 0); // // 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. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet()); ROM_SysTickEnable(); // // Reset the error indicator. // ui32Error = 0; // // Enable interrupts to the processor. // ROM_IntMasterEnable(); // // Enable the interrupts. // ROM_IntEnable(INT_GPIOA); ROM_IntEnable(INT_GPIOB); ROM_IntEnable(INT_GPIOC); // // Indicate that the equal interrupt priority test is beginning. // UARTprintf("/nEqual Priority/n"); // // Set the interrupt priorities so they are all equal. // ROM_IntPrioritySet(INT_GPIOA, 0x00); ROM_IntPrioritySet(INT_GPIOB, 0x00); ROM_IntPrioritySet(INT_GPIOC, 0x00); // // Reset the interrupt flags. // g_ui32GPIOa = 0; g_ui32GPIOb = 0; g_ui32GPIOc = 0; g_ui32Index = 1; // // Trigger the interrupt for GPIO C. // HWREG(NVIC_SW_TRIG) = INT_GPIOC - 16; // // Put the current interrupt state on the LCD. // DisplayIntStatus();//.........这里部分代码省略.........
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,
示例12: main//*****************************************************************************//// Main 'C' Language entry point.////*****************************************************************************intmain(void){ float fTemperature, fPressure, fAltitude; int32_t i32IntegerPart; int32_t i32FractionPart; // // Setup the system clock to run at 40 MHz from PLL with crystal reference // ROM_SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // // Initialize the UART. // ConfigureUART(); // // Print the welcome message to the terminal. // UARTprintf("/033[2JBMP180 Example/n"); // // Set the color to a white approximation. // g_pui32Colors[RED] = 0x8000; g_pui32Colors[BLUE] = 0x8000; g_pui32Colors[GREEN] = 0x8000; // // Initialize RGB driver. Use a default intensity and blink rate. // RGBInit(0); RGBColorSet(g_pui32Colors); RGBIntensitySet(0.5f); RGBEnable(); // // The I2C3 peripheral must be enabled before use. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // // Configure the pin muxing for I2C3 functions on port D0 and D1. // This step is not necessary if your part does not support pin muxing. // ROM_GPIOPinConfigure(GPIO_PD0_I2C3SCL); ROM_GPIOPinConfigure(GPIO_PD1_I2C3SDA); // // Select the I2C function for these pins. This function will also // configure the GPIO pins pins for I2C operation, setting them to // open-drain operation with weak pull-ups. Consult the data sheet // to see which functions are allocated per pin. // GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0); ROM_GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1); // // Initialize the GPIO for the LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0x00); // // Enable interrupts to the processor. // ROM_IntMasterEnable(); // // Initialize the I2C3 peripheral. // I2CMInit(&g_sI2CInst, I2C3_BASE, INT_I2C3, 0xff, 0xff, ROM_SysCtlClockGet()); // // Initialize the BMP180. // BMP180Init(&g_sBMP180Inst, &g_sI2CInst, BMP180_I2C_ADDRESS, BMP180AppCallback, &g_sBMP180Inst); // // Wait for initialization callback to indicate reset request is complete. // while(g_vui8DataFlag == 0) { // // Wait for I2C Transactions to complete. // } ////.........这里部分代码省略.........
开发者ID:amilendra,项目名称:tiva-launchpad,代码行数:101,
示例13: main//*****************************************************************************//// This example encrypts blocks of plaintext using TDES in CBC mode. It// does the encryption first without uDMA and then with uDMA. The results// are checked after each operation.////*****************************************************************************intmain(void){ uint32_t pui32CipherText[16], ui32Errors, ui32Idx, ui32SysClock; // // Run from the PLL at 120 MHz. // ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // // Configure the device pins. // PinoutSet(false, false); // // Initialize local variables. // ui32Errors = 0; for(ui32Idx = 0; ui32Idx < 16; ui32Idx++) { pui32CipherText[ui32Idx] = 0; } // // Enable stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. // ROM_FPUStackingEnable(); // // Enable DES interrupts. // ROM_IntEnable(INT_DES0); // // Enable debug output on UART0 and print a welcome message. // ConfigureUART(); UARTprintf("Starting TDES CBC encryption demo./n"); // // Enable the uDMA module. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); // // Setup the control table. // ROM_uDMAEnable(); ROM_uDMAControlBaseSet(g_psDMAControlTable); // // Initialize the CCM and DES modules. // if(!DESInit()) { UARTprintf("Initialization of the DES module failed./n"); ui32Errors |= 0x00000001; } // // Perform the encryption without uDMA. // UARTprintf("Performing encryption without uDMA./n"); TDESCBCEncrypt(g_pui32TDESPlainText, pui32CipherText, g_pui32TDESKey, 64, g_pui32TDESIV, false); // // Check the result. // for(ui32Idx = 0; ui32Idx < 16; ui32Idx++) { if(pui32CipherText[ui32Idx] != g_pui32TDESCipherText[ui32Idx]) { UARTprintf("Ciphertext mismatch on word %d. Exp: 0x%x, Act: " "0x%x/n", ui32Idx, g_pui32TDESCipherText[ui32Idx], pui32CipherText[ui32Idx]); ui32Errors |= (ui32Idx << 16) | 0x00000002; } } // // Clear the array containing the ciphertext. // for(ui32Idx = 0; ui32Idx < 16; ui32Idx++) { pui32CipherText[ui32Idx] = 0; }//.........这里部分代码省略.........
开发者ID:AdrianoRuseler,项目名称:EK-TM4C129EXL,代码行数:101,
示例14: main//// Main - It performs initialization, then runs a command processing loop to// read commands from the console.//intmain(void){ int nStatus; FRESULT fresult; // // Set the clocking to run from the PLL at 50MHz // SysCtlClockSet(SYSCTL_OSCSRC_OSC2 | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(10) | SYSCTL_SYSDIV(2)); SysCtlAuxClockSet(SYSCTL_OSCSRC_OSC2 | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(12) | SYSCTL_SYSDIV(2)); //60 MHz#ifdef _FLASH//// Copy time critical code and Flash setup code to RAM// This includes the following functions: InitFlash_Bank0();// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart// symbols are created by the linker. Refer to the device .cmd file.// memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);//// Call Flash Initialization to setup flash waitstates// This function must reside in RAM// InitFlash_Bank0();#endif // // Initialize interrupt controller and vector table // InitPieCtrl(); InitPieVectTable(); // // Set the system tick to fire 100 times per second. // SysTickInit(); SysTickPeriodSet(SysCtlClockGet(SYSTEM_CLOCK_SPEED) / 100); SysTickIntRegister(SysTickHandler); SysTickIntEnable(); SysTickEnable(); // // Enable Interrupts // IntMasterEnable(); // // Configure UART0 for debug output. // ConfigureUART(); // // Print hello message to user. // UARTprintf("/n/nSD Card Example Program/n"); UARTprintf("Type /'help/' for help./n"); // // Mount the file system, using logical disk 0. // fresult = f_mount(0, &g_sFatFs); if(fresult != FR_OK) { UARTprintf("f_mount error: %s/n", StringFromFresult(fresult)); return(1); } // // Enter an (almost) infinite loop for reading and processing commands from // the user. // while(1) { // // Print a prompt to the console. Show the CWD. // UARTprintf("/n%s> ", g_cCwdBuf); // // Get a line of text from the user. // UARTgets(g_cCmdBuf, sizeof(g_cCmdBuf)); // // Pass the line from the user to the command processor. // It will be parsed and valid commands executed. // nStatus = CmdLineProcess(g_cCmdBuf); // // Handle the case of bad command. ////.........这里部分代码省略.........
开发者ID:AdrianoRuseler,项目名称:LAUNCHXL-F28377S,代码行数:101,
示例15: main//*****************************************************************************//// Print "Hello World!" to the display.////*****************************************************************************intmain(void){ tContext sContext; tRectangle sRect; // // 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. // ROM_FPULazyStackingEnable(); // // Set the clocking to run directly from the crystal. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // // Initialize the UART. // ConfigureUART(); UARTprintf("Hello, world!/n"); // // Initialize the display driver. // CFAL96x64x16Init(); // // Initialize the graphics context. // GrContextInit(&sContext, &g_sCFAL96x64x16); // // Fill the top 24 rows of the screen with blue to create the banner. // sRect.i16XMin = 0; sRect.i16YMin = 0; sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; sRect.i16YMax = 23; GrContextForegroundSet(&sContext, ClrDarkBlue); GrRectFill(&sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&sContext, ClrWhite); GrRectDraw(&sContext, &sRect); // // Put the application name in the middle of the banner. // GrContextFontSet(&sContext, g_psFontCm12); GrStringDrawCentered(&sContext, "hello", -1, GrContextDpyWidthGet(&sContext) / 2, 10, 0); // // Say hello using the Computer Modern 40 point font. // GrContextFontSet(&sContext, g_psFontCm12/*g_psFontFixed6x8*/); GrStringDrawCentered(&sContext, "Hello World!", -1, GrContextDpyWidthGet(&sContext) / 2, ((GrContextDpyHeightGet(&sContext) - 24) / 2) + 24, 0); // // Flush any cached drawing operations. // GrFlush(&sContext); // // We are finished. Hang around doing nothing. // while(1) { }}
开发者ID:peterliu2,项目名称:tivaWare,代码行数:84,
示例16: main//*****************************************************************************//// This is the main application entry function.////*****************************************************************************intmain(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. // ROM_FPULazyStackingEnable(); // // Set the clocking to run from the PLL at 50MHz // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable the GPIO port that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // // Enable the GPIO pins for the LED (PF2 & PF3). // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1); // // Open UART0 and show the application name on the UART. // ConfigureUART(); UARTprintf("/033[2JTiva C Series USB bulk device example/n"); UARTprintf("---------------------------------/n/n"); // // Not configured initially. // g_bUSBConfigured = false; // // Enable the GPIO peripheral used for USB, and configure the USB // pins. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5); // // Enable the system tick. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Tell the user what we are up to. // UARTprintf("Configuring USB/n"); // // Initialize the transmit and receive buffers. // USBBufferInit(&g_sTxBuffer); USBBufferInit(&g_sRxBuffer); // // Set the USB stack mode to Device mode with VBUS monitoring. // USBStackModeSet(0, eUSBModeForceDevice, 0); // // Pass our device information to the USB library and place the device // on the bus. // myBulk=USBDBulkInit(0, &g_sBulkDevice); // // Wait for initial configuration to complete. // UARTprintf("Waiting for host.../n"); // // Clear our local byte counters. // while(!isUSB_ready); adc_cofig(); // // Main application loop. // while(1) { int readVal; if(txReady){ adc_capture(); ((int*)myOutBuffer)[0]=adc_getData();//.........这里部分代码省略.........
开发者ID:upiitacode,项目名称:PC_03_USB,代码行数:101,
示例17: main//*****************************************************************************//// Main application entry point.////*****************************************************************************intmain(void){ int_fast32_t i32IPart[16], i32FPart[16]; uint_fast32_t ui32Idx, ui32CompDCMStarted; float pfData[16]; float *pfAccel, *pfGyro, *pfMag, *pfEulers, *pfQuaternion; // // Initialize convenience pointers that clean up and clarify the code // meaning. We want all the data in a single contiguous array so that // we can make our pretty printing easier later. // pfAccel = pfData; pfGyro = pfData + 3; pfMag = pfData + 6; pfEulers = pfData + 9; pfQuaternion = pfData + 12; // // Setup the system clock to run at 40 Mhz from PLL with crystal reference // SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // // Enable port B used for motion interrupt. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); // // Initialize the UART. // ConfigureUART(); // // Print the welcome message to the terminal. // UARTprintf("/033[2JMPU9150 Raw Example/n"); // // Set the color to a purple approximation. // g_pui32Colors[RED] = 0x8000; g_pui32Colors[BLUE] = 0x8000; g_pui32Colors[GREEN] = 0x0000; // // Initialize RGB driver. // RGBInit(0); RGBColorSet(g_pui32Colors); RGBIntensitySet(0.5f); RGBEnable(); // // The I2C3 peripheral must be enabled before use. // SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // // Configure the pin muxing for I2C3 functions on port D0 and D1. // GPIOPinConfigure(GPIO_PD0_I2C3SCL); GPIOPinConfigure(GPIO_PD1_I2C3SDA); // // Select the I2C function for these pins. This function will also // configure the GPIO pins pins for I2C operation, setting them to // open-drain operation with weak pull-ups. Consult the data sheet // to see which functions are allocated per pin. // GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0); GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1); // // Configure and Enable the GPIO interrupt. Used for INT signal from the // MPU9150 // GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_2); GPIOIntEnable(GPIO_PORTB_BASE, GPIO_PIN_2); GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_FALLING_EDGE); IntEnable(INT_GPIOB); // // Keep only some parts of the systems running while in sleep mode. // GPIOB is for the MPU9150 interrupt pin. // UART0 is the virtual serial port // TIMER0, TIMER1 and WTIMER5 are used by the RGB driver // I2C3 is the I2C interface to the ISL29023 // SysCtlPeripheralClockGating(true); SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART0);//.........这里部分代码省略.........
开发者ID:rheostat2718,项目名称:mpu9150_driver,代码行数:101,
示例18: main//*****************************************************************************//// This example demonstrates how to use the uDMA controller to transfer data// between memory buffers and to and from a peripheral, in this case a UART.// The uDMA controller is configured to repeatedly transfer a block of data// from one memory buffer to another. It is also set up to repeatedly copy a// block of data from a buffer to the UART output. The UART data is looped// back so the same data is received, and the uDMA controlled is configured to// continuously receive the UART data using ping-pong buffers.//// The processor is put to sleep when it is not doing anything, and this allows// collection of CPU usage data to see how much CPU is being used while the// data transfers are ongoing.////*****************************************************************************intmain(void){ static uint32_t ui32PrevSeconds; static uint32_t ui32PrevXferCount; static uint32_t ui32PrevUARTCount = 0; uint32_t ui32XfersCompleted; uint32_t ui32BytesTransferred; // // 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. // ROM_FPULazyStackingEnable(); // // Set the clocking to run from the PLL at 50 MHz. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable peripherals to operate when CPU is in sleep. // ROM_SysCtlPeripheralClockGating(true); // // Enable the GPIO port that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // // Enable the GPIO pins for the LED (PF2). // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); // // Initialize the UART. // ConfigureUART(); UARTprintf("/033[2JuDMA Example/n"); // // Show the clock frequency on the display. // UARTprintf("Tiva C Series @ %u MHz/n/n", ROM_SysCtlClockGet() / 1000000); // // Show statistics headings. // UARTprintf("CPU Memory UART Remaining/n"); UARTprintf("Usage Transfers Transfers Time/n"); // // Configure SysTick to occur 100 times per second, to use as a time // reference. Enable SysTick to generate interrupts. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Initialize the CPU usage measurement routine. // CPUUsageInit(ROM_SysCtlClockGet(), SYSTICKS_PER_SECOND, 2); // // Enable the uDMA controller at the system level. Enable it to continue // to run while the processor is in sleep. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UDMA); // // Enable the uDMA controller error interrupt. This interrupt will occur // if there is a bus error during a transfer. // ROM_IntEnable(INT_UDMAERR); // // Enable the uDMA controller. // ROM_uDMAEnable();//.........这里部分代码省略.........
开发者ID:RoboEvangelist,项目名称:TivaWare_C_Series-2.1.0.12573,代码行数:101,
示例19: main2int main2(void){ UINT8 IsDHCP = 0; int32_t i32CommandStatus; _NetCfgIpV4Args_t ipV4; unsigned char len = sizeof(_NetCfgIpV4Args_t); int Status = 0; /* Stop WDT */ stopWDT(); /* Initialize the system clock of MCU */ initClk(); Board_Init(); // initialize LaunchPad I/O and PD1 LED ConfigureUART(); // Initialize the UART. UARTprintf("Section 11.4 IoT example, Volume 2 Real-time interfacing/n"); UARTprintf("This application is configured to measure analog signals from Ain7=PD0/n"); UARTprintf(" and send UDP packets to IP: %d.%d.%d.%d Port: %d/n/n", SL_IPV4_BYTE(IP_ADDR,3), SL_IPV4_BYTE(IP_ADDR,2), SL_IPV4_BYTE(IP_ADDR,1), SL_IPV4_BYTE(IP_ADDR,0),PORT_NUM); /* Initializing the CC3100 device */ sl_Start(0, 0, 0); /* Connecting to WLAN AP - Set with static parameters defined at the top After this call we will be connected and have IP address */ WlanConnect(); /* Read the IP parameter */ sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO,&IsDHCP,&len, (unsigned char *)&ipV4); //Print the IP UARTprintf("This node is at IP: %d.%d.%d.%d/n", SL_IPV4_BYTE(ipV4.ipV4,3), SL_IPV4_BYTE(ipV4.ipV4,2), SL_IPV4_BYTE(ipV4.ipV4,1), SL_IPV4_BYTE(ipV4.ipV4,0)); // // Loop forever waiting for commands from PC... // while(1) { // // Print prompt for user. // UARTprintf("/n>"); // // Peek to see if a full command is ready for processing. // while(UARTPeek('/r') == -1) { // // Approximately 1 millisecond delay. // ROM_SysCtlDelay(ROM_SysCtlClockGet() / 3000); } // // A '/r' was detected so get the line of text from the receive buffer. // UARTgets(g_cInput,sizeof(g_cInput)); // // Pass the line from the user to the command processor. // It will be parsed and valid commands executed. // i32CommandStatus = CmdLineProcess(g_cInput); // // Handle the case of bad command. // if(i32CommandStatus == CMDLINE_BAD_CMD) { UARTprintf(" Bad command. Try again./n"); } // // Handle the case of too many arguments. // else if(i32CommandStatus == CMDLINE_TOO_MANY_ARGS) { UARTprintf(" Too many arguments for command. Try again./n"); } // // Handle the case of too few arguments. // else if(i32CommandStatus == CMDLINE_TOO_FEW_ARGS) { UARTprintf(" Too few arguments for command. Try again./n"); } // // Handle the case of too few arguments. // else if(i32CommandStatus == CMDLINE_INVALID_ARG) { UARTprintf(" Invalid command argument(s). Try again./n"); } } }
开发者ID:manavm,项目名称:Classes,代码行数:99,
示例20: main//*****************************************************************************//// Toggle the JTAG pins between JTAG and GPIO mode with a push button selecting// between the two.////*****************************************************************************intmain(void){ uint32_t ui32Mode; // // Set the clocking to run directly from the crystal at 120MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // // Enable the peripherals used by this application. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); // // Initialize the button driver. // ButtonsInit(); // // Set up a SysTick Interrupt to handle polling and debouncing for our // buttons. // SysTickPeriodSet(g_ui32SysClock / 100); SysTickIntEnable(); SysTickEnable(); IntMasterEnable(); // // Configure the LEDs as outputs and turn them on in the JTAG state. // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1); ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_PIN_0); // // Set the global and local indicator of pin mode to zero, meaning JTAG. // g_ui32Mode = 0; ui32Mode = 0; // // Initialize the UART, clear the terminal, print banner. // ConfigureUART(); UARTprintf("/033[2J/033[H"); UARTprintf("GPIO <-> JTAG/n"); // // Indicate that the pins start out as JTAG. // UARTprintf("Pins are JTAG/n"); // // Loop forever. This loop simply exists to display on the UART the // current state of PC0-3; the handling of changing the JTAG pins to and // from GPIO mode is done in GPIO Interrupt Handler. // while(1) { // // Wait until the pin mode changes. // while(g_ui32Mode == ui32Mode) { } // // Save the new mode locally so that a subsequent pin mode change can // be detected. // ui32Mode = g_ui32Mode; // // See what the new pin mode was changed to. // if(ui32Mode == 0) { // // Indicate that PC0-3 are currently JTAG pins. // UARTprintf("Pins are JTAG/n"); } else { // // Indicate that PC0-3 are currently GPIO pins. ////.........这里部分代码省略.........
开发者ID:mileat,项目名称:proj-emb,代码行数:101,
示例21: main//*****************************************************************************//// This is the main loop that runs the application.////*****************************************************************************intmain(void){ // // Turn on stacking of FPU registers if FPU is used in the ISR. // FPULazyStackingEnable(); // // Set the clocking to run from the PLL at 40MHz. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Set the system tick to fire 100 times per second. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Enable the Debug UART. // ConfigureUART(); // // Print the welcome message to the terminal. // UARTprintf("/033[2JAir Mouse Application/n"); // // Configure desired interrupt priorities. This makes certain that the DCM // is fed data at a consistent rate. Lower numbers equal higher priority. // ROM_IntPrioritySet(INT_I2C3, 0x00); ROM_IntPrioritySet(INT_GPIOB, 0x10); ROM_IntPrioritySet(FAULT_SYSTICK, 0x20); ROM_IntPrioritySet(INT_UART1, 0x60); ROM_IntPrioritySet(INT_UART0, 0x70); ROM_IntPrioritySet(INT_WTIMER5B, 0x80); // // Configure the USB D+ and D- pins. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // USBDHIDMouseCompositeInit(0, &g_sMouseDevice, &g_psCompDevices[0]); USBDHIDKeyboardCompositeInit(0, &g_sKeyboardDevice, &g_psCompDevices[1]); // // Set the USB stack mode to Force Device mode. // USBStackModeSet(0, eUSBModeForceDevice, 0); // // Pass the device information to the USB library and place the device // on the bus. // USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE, g_pui8DescriptorData); // // User Interface Init // ButtonsInit(); RGBInit(0); RGBEnable(); // // Initialize the motion sub system. // MotionInit(); // // Initialize the Radio Systems. // LPRFInit(); // // Drop into the main loop. // while(1) { // // Check for and handle timer tick events. // if(HWREGBITW(&g_ui32Events, USB_TICK_EVENT) == 1) {//.........这里部分代码省略.........
开发者ID:bli19,项目名称:unesp_mdt,代码行数:101,
示例22: initsensorhubvoid initsensorhub(void){ // // Enable port B used for motion interrupt. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); // // Initialize the UART. // ConfigureUART(); // // Print the welcome message to the terminal. // UARTprintf("/033[2JMPU9150 Raw Example/n"); // // Set the color to a purple approximation. // g_pui32Colors[RED] = 0x8000; g_pui32Colors[BLUE] = 0x8000; g_pui32Colors[GREEN] = 0x0000; // // Initialize RGB driver. // RGBInit(0); RGBColorSet(g_pui32Colors); RGBIntensitySet(0.5f); RGBEnable(); // // The I2C3 peripheral must be enabled before use. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // // Configure the pin muxing for I2C3 functions on port D0 and D1. // ROM_GPIOPinConfigure(GPIO_PD0_I2C3SCL); ROM_GPIOPinConfigure(GPIO_PD1_I2C3SDA); // // Select the I2C function for these pins. This function will also // configure the GPIO pins pins for I2C operation, setting them to // open-drain operation with weak pull-ups. Consult the data sheet // to see which functions are allocated per pin. // GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0); ROM_GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1); // // Configure and Enable the GPIO interrupt. Used for INT signal from the // MPU9150 // ROM_GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_2); GPIOIntEnable(GPIO_PORTB_BASE, GPIO_PIN_2); ROM_GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_FALLING_EDGE); ROM_IntEnable(INT_GPIOB); // // Keep only some parts of the systems running while in sleep mode. // GPIOB is for the MPU9150 interrupt pin. // UART0 is the virtual serial port // TIMER0, TIMER1 and WTIMER5 are used by the RGB driver // I2C3 is the I2C interface to the ISL29023 // ROM_SysCtlPeripheralClockGating(true); ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOB); ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART0); ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_TIMER0); ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_TIMER1); ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_I2C3); ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_WTIMER5); // // Enable interrupts to the processor. // ROM_IntMasterEnable(); // // Initialize I2C3 peripheral. // I2CMInit(&g_sI2CInst, I2C3_BASE, INT_I2C3, 0xff, 0xff, ROM_SysCtlClockGet()); // // Initialize the MPU9150 Driver. // MPU9150Init(&g_sMPU9150Inst, &g_sI2CInst, MPU9150_I2C_ADDRESS, MPU9150AppCallback, &g_sMPU9150Inst); // // Wait for transaction to complete // MPU9150AppI2CWait(__FILE__, __LINE__); ////.........这里部分代码省略.........
开发者ID:eolear7,项目名称:SEGWAY-ECE-UH,代码行数:101,
示例23: main//*****************************************************************************//// This is the main application entry function.////*****************************************************************************intmain(void){ volatile uint32_t ui32Loop; uint32_t ui32TxCount; uint32_t ui32RxCount; // // 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. // ROM_FPULazyStackingEnable(); // // Set the clocking to run from the PLL at 50MHz // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable the GPIO port that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // // Enable the GPIO pins for the LED (PF2 & PF3). // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3 | GPIO_PIN_2); // // Open UART0 and show the application name on the UART. // ConfigureUART(); UARTprintf("/033[2JTiva C Series USB bulk device example/n"); UARTprintf("---------------------------------/n/n"); // // Not configured initially. // g_bUSBConfigured = false; // // Enable the GPIO peripheral used for USB, and configure the USB // pins. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5); // // Enable the system tick. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Tell the user what we are up to. // UARTprintf("Configuring USB/n"); // // Initialize the transmit and receive buffers. // USBBufferInit(&g_sTxBuffer); USBBufferInit(&g_sRxBuffer); // // Set the USB stack mode to Device mode with VBUS monitoring. // USBStackModeSet(0, eUSBModeForceDevice, 0); // // Pass our device information to the USB library and place the device // on the bus. // USBDBulkInit(0, &g_sBulkDevice); // // Wait for initial configuration to complete. // UARTprintf("Waiting for host.../n"); // // Clear our local byte counters. // ui32RxCount = 0; ui32TxCount = 0; // // Main application loop. // while(1) {//.........这里部分代码省略.........
开发者ID:ilemus,项目名称:uCOS-II,代码行数:101,
示例24: main//*****************************************************************************//// This example decrypts a block of payload using AES128 in CCM mode. It// does the decryption first without uDMA and then with uDMA. The results// are checked after each operation.////*****************************************************************************intmain(void){ uint32_t pui32Payload[16], pui32Tag[4], ui32Errors, ui32Idx; uint32_t ui32PayloadLength, ui32TagLength; uint32_t ui32NonceLength, ui32AuthDataLength; uint32_t *pui32Nonce, *pui32AuthData, ui32SysClock; uint32_t *pui32Key, *pui32ExpPayload, *pui32CipherText; uint8_t ui8Vector; uint8_t *pui8ExpTag, *pui8Tag; tContext sContext; // // Run from the PLL at 120 MHz. // ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // // Configure the device pins. // PinoutSet(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(ui32SysClock); // // Initialize the graphics context. // GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&sContext, "aes128-ccm-decrypt"); // // Show some instructions on the display // GrContextFontSet(&sContext, g_psFontCm20); GrContextForegroundSet(&sContext, ClrWhite); GrStringDrawCentered(&sContext, "Connect a terminal to", -1, GrContextDpyWidthGet(&sContext) / 2, 60, false); GrStringDrawCentered(&sContext, "UART0 (115200,N,8,1)", -1, GrContextDpyWidthGet(&sContext) / 2, 80, false); GrStringDrawCentered(&sContext, "for more information.", -1, GrContextDpyWidthGet(&sContext) / 2, 100, false); // // Initialize local variables. // ui32Errors = 0; for(ui32Idx = 0; ui32Idx < 16; ui32Idx++) { pui32Payload[ui32Idx] = 0; } for(ui32Idx = 0; ui32Idx < 4; ui32Idx++) { pui32Tag[ui32Idx] = 0; } pui8Tag = (uint8_t *)pui32Tag; // // Enable stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. // ROM_FPUStackingEnable(); // // Configure the system clock to run off the internal 16MHz oscillator. // ROM_SysCtlClockFreqSet(SYSCTL_OSC_INT | SYSCTL_USE_OSC, 16000000); // // Enable AES interrupts. // ROM_IntEnable(INT_AES0); // // Enable debug output on UART0 and print a welcome message. // ConfigureUART(); UARTprintf("Starting AES128 CCM decryption demo./n"); GrStringDrawCentered(&sContext, "Starting demo...", -1, GrContextDpyWidthGet(&sContext) / 2, 140, false); // // Enable the uDMA module.//.........这里部分代码省略.........
开发者ID:bli19,项目名称:unesp_mdt,代码行数:101,
示例25: mainvoid main (void){ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); ROM_SysCtlClockSet (SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); IntMasterEnable(); ConfigureUART(); ConfigureGPRS(); float fAccel[3]; tMPU9150 sMPU9150; UARTprintf("Point 0/n"); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_GPIOPinConfigure(GPIO_PD0_I2C3SCL); ROM_GPIOPinConfigure(GPIO_PD1_I2C3SDA); // // Select the I2C function for these pins. This function will also // configure the GPIO pins pins for I2C operation, setting them to // open-drain operation with weak pull-ups. Consult the data sheet // to see which functions are allocated per pin. // GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0); ROM_GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1); // // Initialize the MPU9150. This code assumes that the I2C master instance // has already been initialized. // I2CMInit(&sI2CInst, I2C3_BASE, INT_I2C3, 0xff, 0xff, ROM_SysCtlClockGet()); GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 4); UARTprintf("Point 2/n"); g_bMPU9150Done = false; MPU9150Init(&sMPU9150, &sI2CInst, 0x68, MPU9150Callback, 0); while(!g_bMPU9150Done) { } // // Configure the MPU9150 for +/- 4 g accelerometer range. // UARTprintf("Point 3/n"); g_bMPU9150Done = false; // MPU9150ReadModifyWrite(&sMPU9150, MPU9150_O_ACCEL_CONFIG, // ~MPU9150_ACCEL_CONFIG_AFS_SEL_M, // MPU9150_ACCEL_CONFIG_AFS_SEL_16G, MPU9150Callback, // 0); sMPU9150.pui8Data[0] = MPU9150_CONFIG_DLPF_CFG_94_98; sMPU9150.pui8Data[1] = MPU9150_GYRO_CONFIG_FS_SEL_250; sMPU9150.pui8Data[2] = (MPU9150_ACCEL_CONFIG_ACCEL_HPF_5HZ | MPU9150_ACCEL_CONFIG_AFS_SEL_16G); MPU9150Write(&sMPU9150, MPU9150_O_CONFIG, sMPU9150.pui8Data, 3, MPU9150Callback, 0); // while(1){} while(!g_bMPU9150Done) { } // // Loop forever reading data from the MPU9150. Typically, this process // would be done in the background, but for the purposes of this example, // it is shown in an infinite loop. // int count=0; int prev_count=-100; int is_acc=0; float imp[3]; int j=0; for(;j<2;j++) imp[j]=0; float curr_avg=0; while(1) { GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 8); // // Request another reading from the MPU9150. // g_bMPU9150Done = false; if(!MPU9150DataRead(&sMPU9150, MPU9150Callback, 0)) continue; while(!g_bMPU9150Done) { } // // Get the new accelerometer, gyroscope, and magnetometer readings. // float backup[3]; int l=0; if(count!=0)for(;l<3;l++)backup[l]=fAccel[l]; MPU9150DataAccelGetFloat(&sMPU9150, &fAccel[0], &fAccel[1], &fAccel[2]); // MPU9150DataGyroGetFloat(&sMPU9150, &fGyro[0], &fGyro[1], &fGyro[2]); // MPU9150DataMagnetoGetFloat(&sMPU9150, &fMagneto[0], &fMagneto[1],//.........这里部分代码省略.........
开发者ID:CS308-2016,项目名称:Accident_Autodialer,代码行数:101,
示例26: main//*****************************************************************************//// This is the main application entry function.////*****************************************************************************intmain(void){ uint_fast32_t ui32TxCount; uint_fast32_t ui32RxCount; tRectangle sRect; char pcBuffer[16]; // // 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. // ROM_FPULazyStackingEnable(); // // Set the clocking to run from the PLL at 50MHz // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);#ifdef DEBUG // // Configure the UART for debug output. // ConfigureUART();#endif // // Not configured initially. // g_bUSBConfigured = false; // // Initialize the display driver. // CFAL96x64x16Init(); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sCFAL96x64x16); // // Fill the top part of the screen with blue to create the banner. // sRect.i16XMin = 0; sRect.i16YMin = 0; sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.i16YMax = 9; GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); // // Change foreground for white text. // GrContextForegroundSet(&g_sContext, ClrWhite); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, g_psFontFixed6x8); GrStringDrawCentered(&g_sContext, "usb-dev-bulk", -1, GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); // // Show the various static text elements on the color STN display. // GrStringDraw(&g_sContext, "Tx bytes:", -1, 0, 32, false); GrStringDraw(&g_sContext, "Rx bytes:", -1, 0, 42, false); // // Enable the GPIO peripheral used for USB, and configure the USB // pins. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); // // Enable the system tick. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Show the application name on the display and UART output. // DEBUG_PRINT("/nTiva C Series USB bulk device example/n"); DEBUG_PRINT("---------------------------------/n/n"); // // Tell the user what we are up to.//.........这里部分代码省略.........
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,
示例27: main//*****************************************************************************//// This example demonstrates how to configure MPU regions for different levels// of memory protection. The following memory map is set up://// 0000.0000 - 0000.1C00 - rgn 0: executable read-only, flash// 0000.1C00 - 0000.2000 - rgn 0: no access, flash (disabled sub-region 7)// 2000.0000 - 2000.4000 - rgn 1: read-write, RAM// 2000.4000 - 2000.6000 - rgn 2: read-only, RAM (disabled sub-rgn 4 of rgn 1)// 2000.6000 - 2000.7FFF - rgn 1: read-write, RAM// 4000.0000 - 4001.0000 - rgn 3: read-write, peripherals// 4001.0000 - 4002.0000 - rgn 3: no access (disabled sub-region 1)// 4002.0000 - 4006.0000 - rgn 3: read-write, peripherals// 4006.0000 - 4008.0000 - rgn 3: no access (disabled sub-region 6, 7)// E000.E000 - E000.F000 - rgn 4: read-write, NVIC// 0100.0000 - 0100.FFFF - rgn 5: executable read-only, ROM//// The example code will attempt to perform the following operations and check// the faulting behavior://// - write to flash (should fault)// - read from the disabled area of flash (should fault)// - read from the read-only area of RAM (should not fault)// - write to the read-only section of RAM (should fault)////*****************************************************************************intmain(void){ unsigned int bFail = 0; // 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. ROM_FPULazyStackingEnable(); // Set the clocking to run directly from the crystal. ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // Initialize the UART and write status. ConfigureUART(); UARTprintf("/033[2JMPU example/n"); // Configure an executable, read-only MPU region for flash. It is a 16 KB // region with the last 2 KB disabled to result in a 14 KB executable // region. This region is needed so that the program can execute from // flash. ROM_MPURegionSet(0, FLASH_BASE, MPU_RGN_SIZE_16K | MPU_RGN_PERM_EXEC | MPU_RGN_PERM_PRV_RO_USR_RO | MPU_SUB_RGN_DISABLE_7 | MPU_RGN_ENABLE); // Configure a read-write MPU region for RAM. It is a 32 KB region. There // is a 4 KB sub-region in the middle that is disabled in order to open up // a hole in which different permissions can be applied. ROM_MPURegionSet(1, SRAM_BASE, MPU_RGN_SIZE_32K | MPU_RGN_PERM_NOEXEC | MPU_RGN_PERM_PRV_RW_USR_RW | MPU_SUB_RGN_DISABLE_4 | MPU_RGN_ENABLE); // Configure a read-only MPU region for the 4 KB of RAM that is disabled in // the previous region. This region is used for demonstrating read-only // permissions. ROM_MPURegionSet(2, SRAM_BASE + 0x4000, MPU_RGN_SIZE_2K | MPU_RGN_PERM_NOEXEC | MPU_RGN_PERM_PRV_RO_USR_RO | MPU_RGN_ENABLE); // Configure a read-write MPU region for peripherals. The region is 512 KB // total size, with several sub-regions disabled to prevent access to areas // where there are no peripherals. This region is needed because the // program needs access to some peripherals. ROM_MPURegionSet(3, 0x40000000, MPU_RGN_SIZE_512K | MPU_RGN_PERM_NOEXEC | MPU_RGN_PERM_PRV_RW_USR_RW | MPU_SUB_RGN_DISABLE_1 | MPU_SUB_RGN_DISABLE_6 | MPU_SUB_RGN_DISABLE_7 | MPU_RGN_ENABLE); // Configure a read-write MPU region for access to the NVIC. The region is // 4 KB in size. This region is needed because NVIC registers are needed // in order to control the MPU. ROM_MPURegionSet(4, NVIC_BASE, MPU_RGN_SIZE_4K | MPU_RGN_PERM_NOEXEC | MPU_RGN_PERM_PRV_RW_USR_RW | MPU_RGN_ENABLE); // Configure an executable, read-only MPU region for ROM. It is a 64 KB // region. This region is needed so that ROM library calls work. ROM_MPURegionSet(5, (uint32_t)ROM_APITABLE & 0xFFFF0000, MPU_RGN_SIZE_64K | MPU_RGN_PERM_EXEC | MPU_RGN_PERM_PRV_RO_USR_RO | MPU_RGN_ENABLE); // Need to clear the NVIC fault status register to make sure there is no // status hanging around from a previous program. g_ui32FaultStatus = HWREG(NVIC_FAULT_STAT); HWREG(NVIC_FAULT_STAT) = g_ui32FaultStatus; // Enable the MPU fault. ROM_IntEnable(FAULT_MPU);//.........这里部分代码省略.........
开发者ID:martinjaime,项目名称:MartinJaime_CpE403_labs,代码行数:101,
示例28: main//*****************************************************************************//// This example application demonstrates the use of the timers to generate// periodic interrupts.////*****************************************************************************intmain(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. // FPUEnable(); FPULazyStackingEnable(); // // Set the clocking to run directly from the crystal. // SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable processor interrupts. // IntMasterEnable(); // // Initialize the UART and write status. // ConfigureUART(); ConfigureXBeeUART(); ConfigureUARTSensores(); ButtonsInit(); inicializa_motores(); // // Enable the peripherals used by this example. // SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1); // // Configure the two 32-bit periodic timers. // TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC); TimerLoadSet(TIMER1_BASE, TIMER_A, SysCtlClockGet()/200000); // // Setup the interrupts for the timer timeouts. // IntEnable(INT_TIMER1A); TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT); // // Enable the timers. // TimerEnable(TIMER1_BASE, TIMER_A); // Configure a wide timer for timing purposes SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER0); TimerConfigure(WTIMER0_BASE, TIMER_CFG_PERIODIC_UP); TimerLoadSet64(WTIMER0_BASE, (((long long)1) << 60)); TimerEnable(WTIMER0_BASE, TIMER_A); int counter_verify_no_ar = 0; while(1) { SysCtlDelay(SysCtlClockGet() / 1000); checkButtons(); readPackage(); counter_verify_no_ar++; if (counter_verify_no_ar == 1000) { counter_verify_no_ar = 0; if (no_ar) { enviaNoAr(); no_ar = false; } if (no_chao) { enviaNoChao(); no_chao = false; } } }}
开发者ID:Teider,项目名称:QuIES,代码行数:93,
示例29: main//*****************************************************************************//// This is the main loop that runs the application.////*****************************************************************************intmain(void){ uint8_t ui8ButtonsChanged, ui8Buttons; bool bUpdate; // // Set the clocking to run from the PLL at 50MHz // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable the GPIO port that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // // Enable the GPIO pin for the Blue LED (PF2). // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); // // Open UART0 and show the application name on the UART. // ConfigureUART(); UARTprintf("/033[2JTiva C Series USB gamepad device example/n"); UARTprintf("---------------------------------/n/n"); // // Not configured initially. // g_iGamepadState = eStateNotConfigured; // // Enable the GPIO peripheral used for USB, and configure the USB // pins. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOD); ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_AHB_BASE, GPIO_PIN_4 | GPIO_PIN_5); // // Configure the GPIOS for the buttons. // ButtonsInit(); // // Initialize the ADC channels. // ADCInit(); // // Tell the user what we are up to. // UARTprintf("Configuring USB/n"); // // Set the USB stack mode to Device mode. // USBStackModeSet(0, eUSBModeForceDevice, 0); // // Pass the device information to the USB library and place the device // on the bus. // USBDHIDGamepadInit(0, &g_sGamepadDevice); // // Zero out the initial report. // sReport.ui8Buttons = 0; sReport.i8XPos = 0; sReport.i8YPos = 0; sReport.i8ZPos = 0; // // Tell the user what we are doing and provide some basic instructions. // UARTprintf("/nWaiting For Host.../n"); // // Trigger an initial ADC sequence. // ADCProcessorTrigger(ADC0_BASE, 0); // // The main loop starts here. We begin by waiting for a host connection // then drop into the main gamepad handling section. If the host // disconnects, we return to the top and wait for a new connection. // while(1) { ////.........这里部分代码省略.........
开发者ID:RevaReva,项目名称:tiva-c,代码行数:101,
注:本文中的ConfigureUART函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Conj函数代码示例 C++ Configuration函数代码示例 |