这篇教程C++ usnprintf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中usnprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ usnprintf函数的具体用法?C++ usnprintf怎么用?C++ usnprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了usnprintf函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainint main(){ // Set the clocking to run directly from the crystal. SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); //Initialize peripherals InitializeDisplay(); InitializeTimers(); InitializeADC(); InitializeInterrupts(); //Main program loop unsigned long avgADCValue = 0; while(1) { if(BufOneReadyToRead) { avgADCValue = GetAvgOfBuf(1); usnprintf(str, 25, "Buf1: %5u", avgADCValue); RIT128x96x4StringDraw(str, 0, 0, 15); BufOneReadyToRead = 0; } else if(BufTwoReadyToRead) { avgADCValue = GetAvgOfBuf(2); usnprintf(str, 25, "Buf2: %5u", avgADCValue); RIT128x96x4StringDraw(str, 0, 10, 15); BufTwoReadyToRead = 0; } }}
开发者ID:FTGStudio,项目名称:Sound-Visualizer,代码行数:31,
示例2: FlashStoreReport//*****************************************************************************//// Report to the user the amount of free space and used space in the data// storage area.////*****************************************************************************voidFlashStoreReport(void){ unsigned long ulAddr; unsigned long ulFreeBlocks = 0; unsigned long ulUsedBlocks = 0; static char cBufFree[16]; static char cBufUsed[16]; // // Loop through each block of the storage area and count how many blocks // are free and non-free. // for(ulAddr = FLASH_STORE_START_ADDR; ulAddr < FLASH_STORE_END_ADDR; ulAddr += 0x400) { if(IsBlockFree(ulAddr)) { ulFreeBlocks++; } else { ulUsedBlocks++; } } // // Report the result to the user via a status display screen. // usnprintf(cBufFree, sizeof(cBufFree), "FREE: %3uK", ulFreeBlocks); usnprintf(cBufUsed, sizeof(cBufUsed), "USED: %3uK", ulUsedBlocks); SetStatusText("FREE FLASH", cBufFree, cBufUsed, "PRESS <");}
开发者ID:shadowpho,项目名称:Chalk-Bot,代码行数:39,
示例3: mainvoid main () { SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // NOTE: actual clock speed is pll / 2/ div = 400M / 2/ 10// SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); initializeGlobalData(); // initialize global data#if DEBUG RIT128x96x4Init(1000000);#endif#if DEBUG char num[30]; usnprintf(num, 30, "begin CommandTest"); RIT128x96x4StringDraw(num, 0, 0, 15);#endif strncpy(global.commandStr, "M A", COMMAND_LENGTH - 1); // this is the test command commandTask.runTaskFunction(commandTask.taskDataPtr); #if DEBUG usnprintf(num, 30, global.responseStr); RIT128x96x4StringDraw(num, 0, 70, 7); usnprintf(num, 30, "done %d %d", global.measurementSelection, global.responseReady); RIT128x96x4StringDraw(num, 0, 80, 15);#endif}
开发者ID:ellingjp,项目名称:ee472,代码行数:29,
示例4: io_get_statusvoid io_get_status(char * pcBuf, int iBufLen){ if (reflow_get_instance()->active) { usnprintf(pcBuf, iBufLen, "on"); } else { usnprintf(pcBuf, iBufLen, "off"); }}
开发者ID:exziled,项目名称:PCB-Toaster-Firmware,代码行数:8,
示例5: MainLoopRun//*****************************************************************************//// The main loop of the application. This implementation is specific to the// EK-LM4F232 board and merely displays the current timer count value and the// number of interrupts taken. It contains nothing directly relevant to the// timer configuration or operation.////*****************************************************************************voidMainLoopRun(void){ uint32_t ui32Count, ui32LastCount; // // Set up for the main loop. // ui32LastCount = 10; // // Loop forever while the timer runs. // while(1) { // // Get the current timer count. // ui32Count = ROM_TimerValueGet(TIMER4_BASE, TIMER_A); // // Has it changed? // if(ui32Count != ui32LastCount) { // // Yes - update the display. // usnprintf(g_pcPrintBuff, PRINT_BUFF_SIZE, "%d ", ui32Count); GrStringDraw(&g_sContext, g_pcPrintBuff, -1, 80, 26, true); // // Remember the new count value. // ui32LastCount = ui32Count; } // // Has there been an interrupt since last we checked? // if(HWREGBITW(&g_ui32Flags, 0)) { // // Clear the bit. // HWREGBITW(&g_ui32Flags, 0) = 0; // // Update the interrupt count. // usnprintf(g_pcPrintBuff, PRINT_BUFF_SIZE, "%d ", g_ui32IntCount); GrStringDraw(&g_sContext, g_pcPrintBuff, -1, 80, 36, true); } }}
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:63,
示例6: ISL29023DataEncodeJSON//*****************************************************************************//// This function will encode the sensor data into a JSON format string.//// /param pcBuf is a pointer to a buffer where the JSON string is stored.// /param ui32BufSize is the size of the buffer pointer to by pcBuf.//// /return the number of bytes written to pcBuf as indicated by usnprintf.////*****************************************************************************uint32_tISL29023DataEncodeJSON(char *pcBuf, uint32_t ui32BufSize){ uint32_t ui32SpaceUsed; char pcVisibleBuf[12]; char pcInfraredBuf[12]; // // Convert the floating point members of the struct into strings. // uftostr(pcVisibleBuf, 12, 3, g_sISL29023Data.fVisible); uftostr(pcInfraredBuf, 12, 3, g_sISL29023Data.fInfrared); // // Merge the strings into the buffer in JSON format. // ui32SpaceUsed = usnprintf(pcBuf, ui32BufSize, "{/"sISL29023Data_t/":{" "/"bActive/":%d,/"fVisible/":%s," "/"fInfrared/":%s,/"ui8Range/":%d}}", g_sISL29023Data.bActive, pcVisibleBuf, pcInfraredBuf, g_sISL29023Data.ui8Range); // // Return size of string created. // return ui32SpaceUsed;}
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:38,
示例7: io_get_pwmstate//*****************************************************************************//// Return PWM state////*****************************************************************************voidio_get_pwmstate(char * pcBuf, int iBufLen){ // // Get the state of the PWM1 // if(HWREG(PWM_BASE + PWM_O_ENABLE) & PWM_OUT_1_BIT) { usnprintf(pcBuf, iBufLen, "ON"); } else { usnprintf(pcBuf, iBufLen, "OFF"); }}
开发者ID:longluo,项目名称:Network_LM3S8962,代码行数:21,
示例8: io_get_ledstate//*****************************************************************************//// Return LED state////*****************************************************************************voidio_get_ledstate(char * pcBuf, int iBufLen){ // // Get the state of the LED // if(ROM_GPIOPinRead(LED_PORT_BASE, LED_PIN)) { usnprintf(pcBuf, iBufLen, "ON"); } else { usnprintf(pcBuf, iBufLen, "OFF"); }}
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:21,
示例9: cmd_stats/* This function prints out some module stats*/int cmd_stats(int argc, char *argv[]) { struct uart_info *uart_config; struct crc_info *crc_config; struct relay_info *relay_config; char buf[3]; for(size_t i = MODULE1; i <= MODULE4; i++) { if(module_exists(i)) { switch (module_profile_id(i)) { case PROFILE_UART: { uart_config = get_uart_profile(i); cmd_print("/r/nmodule id: %d base: %X port: %d rcv: %d sent: %d err: %d lost: %d buf: %d profile: ", i, uart_config->base, uart_config->port,uart_config->recv, uart_config->sent, uart_config->err, uart_config->lost,uart_config->buf_size * UART_QUEUE_SIZE); usnprintf((char *)&buf, 3, "%d",i+1); argc=2; argv[1]=(char *)&buf; read_uartmode(argc,argv); break;} case PROFILE_CRC: { crc_config = get_crc_profile(i); cmd_print("/r/nmodule id: %d profile: %s crc: %X crc2: %X", i, "crc error", crc_config->crc,crc_config->crc2); break;} case PROFILE_RELAY: { relay_config = get_relay_profile(i); cmd_print("/r/nmodule id: %d profile: %s start_value: %d negation: %d convert: %d", i, "relay", relay_config->start_value, relay_config->negation, relay_config->convert); break; } }; } else { cmd_print("/r/nmodule id: %d not available", i); } } return(0);}
开发者ID:drthth,项目名称:busware,代码行数:36,
示例10: MenuInit//*****************************************************************************//// Initialize the offscreen buffers and the menu structure. This should be// called before using the application menus.// The parameter is a function pointer to a callback function whenever the// menu widget activates or deactivates a child widget.////*****************************************************************************voidMenuInit(void (*pfnActive)(tWidget *, tSlideMenuItem *, bool)){ uint32_t ui32Idx; // // Initialize two offscreen displays and assign the palette. These // buffers are used by the slide menu widget and other parts of the // application to allow for animation effects. // GrOffScreen4BPPInit(&g_sOffscreenDisplayA, g_pui8OffscreenBufA, 96, 64); GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplayA, g_pui32Palette, 0, NUM_PALETTE_ENTRIES); GrOffScreen4BPPInit(&g_sOffscreenDisplayB, g_pui8OffscreenBufB, 96, 64); GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplayB, g_pui32Palette, 0, NUM_PALETTE_ENTRIES); // // Initialize each of the text fields with a "blank" indication. // for(ui32Idx = 0; ui32Idx < NUM_LOG_ITEMS; ui32Idx++) { usnprintf(g_pcTextFields[ui32Idx], TEXT_FIELD_LENGTH, "----"); } // // Set the slide menu widget callback function. // SlideMenuActiveCallbackSet(&g_sMenuWidget, pfnActive);}
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:38,
示例11: io_get_ledstate//*****************************************************************************//// Return LED state////*****************************************************************************voidio_get_ledstate(char * pcBuf, int iBufLen){ // // Get the state of the LED // if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_0)) { usnprintf(pcBuf, iBufLen, "ON"); } else { usnprintf(pcBuf, iBufLen, "OFF"); }}
开发者ID:longluo,项目名称:Network_LM3S8962,代码行数:21,
示例12: TimerAIntHandlervoid TimerAIntHandler(void) { minor_cycle_ctr++; #if DEBUG char num[30]; usnprintf(num, 30, "minor_cycle_ctr = %d ", minor_cycle_ctr); RIT128x96x4StringDraw(num, 0, 80, 15);#endif TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);}
开发者ID:ellingjp,项目名称:ee472,代码行数:11,
示例13: Handler2void Handler2() { TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT); ADCProcessorTrigger(ADC_BASE, 0); while (!ADCIntStatus(ADC_BASE, 0, false)); ADCSequenceDataGet(ADC_BASE, 0, &ADC_resultValue); pwm = ((double) 400 / 1024) * ADC_resultValue; usnprintf(buffer, BUFFSIZE, "ADC : %d/n", (int)ADC_resultValue); UARTPrint0((unsigned char *) buffer);}
开发者ID:ilabmp,项目名称:micro,代码行数:12,
示例14: io_get_powervoid io_get_power(char * pcBuf, int iBufLen, char * heater, int size){ uint8_t h_index = atoi(heater); uint8_t power = 0; if (h_index < 2) { power = triac_map[h_index].duty_cycle; } usnprintf(pcBuf, iBufLen, "%d", power);}
开发者ID:exziled,项目名称:PCB-Toaster-Firmware,代码行数:12,
示例15: MenuUpdateText//*****************************************************************************//// This function allows dynamic text fields to be updated.////*****************************************************************************voidMenuUpdateText(uint32_t ui32TextID, const char *pcText){ // // If the text field ID is valid, then update the string for that text // field. The next time the associated widget is painted, the new text // will be shown. // if(ui32TextID < NUM_TEXT_ITEMS) { usnprintf(g_pcTextFields[ui32TextID], TEXT_FIELD_LENGTH, "%s", pcText); }}
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:18,
示例16: js_is_connectedBYTE js_is_connected(int dev) { uTCHAR path_dev[30]; int fd; usnprintf(path_dev, usizeof(path_dev), uL("" JS_DEV_PATH "%d"), dev); if ((fd = uopen(path_dev, O_RDONLY | O_NONBLOCK)) < 0) { return (EXIT_ERROR); } close(fd); return (EXIT_OK);}
开发者ID:punesemu,项目名称:puNES,代码行数:13,
示例17: FlashStoreReport//*****************************************************************************//// Report to the user the amount of free space and used space in the data// storage area.////*****************************************************************************voidFlashStoreReport(void){ uint32_t ui32Addr, ui32FreeBlocks, ui32UsedBlocks = 0; static char pcBufFree[16], pcBufUsed[16]; // // Initialize locals. // ui32FreeBlocks = 0; ui32UsedBlocks = 0; // // Loop through each block of the storage area and count how many blocks // are free and non-free. // for(ui32Addr = FLASH_STORE_START_ADDR; ui32Addr < FLASH_STORE_END_ADDR; ui32Addr += 0x400) { if(IsBlockFree(ui32Addr)) { ui32FreeBlocks++; } else { ui32UsedBlocks++; } } // // Report the result to the user via a status display screen. // usnprintf(pcBufFree, sizeof(pcBufFree), "FREE: %3uK", ui32FreeBlocks); usnprintf(pcBufUsed, sizeof(pcBufUsed), "USED: %3uK", ui32UsedBlocks); SetStatusText("FREE FLASH", pcBufFree, pcBufUsed, "PRESS <");}
开发者ID:bli19,项目名称:unesp_mdt,代码行数:42,
示例18: js_initvoid js_init(void) { BYTE i; for (i = PORT1; i < PORT_MAX; i++) { memset(&js[i], 0x00, sizeof(_js)); if (port[i].joy_id == name_to_jsn(uL("NULL"))) { continue; } usnprintf(js[i].dev, usizeof(js[i].dev), uL("" JS_DEV_PATH "%d"), port[i].joy_id); js[i].input_decode_event = input_decode_event[i]; js_open(&js[i]); }}
开发者ID:punesemu,项目名称:puNES,代码行数:15,
示例19: EncodeFormString//*****************************************************************************//// Encodes a string for use within an HTML tag, escaping non alphanumeric// characters.//// /param pcDecoded is a pointer to a null terminated ASCII string.// /param pcEncoded is a pointer to a storage for the encoded string.// /param ulLen is the number of bytes of storage pointed to by pcEncoded.//// This function encodes a string, adding escapes in place of any special,// non-alphanumeric characters. If the encoded string is too long for the// provided output buffer, the output will be truncated.//// /return Returns the number of characters written to the output buffer// not including the terminating NULL.////*****************************************************************************unsigned longEncodeFormString(const char *pcDecoded, char *pcEncoded, unsigned long ulLen){ unsigned long ulLoop; unsigned long ulCount; // // Make sure we were not passed a tiny buffer. // if(ulLen <= 1) { return(0); } // // Initialize our output character counter. // ulCount = 0; // // Step through each character of the input until we run out of data or // space to put our output in. // for(ulLoop = 0; pcDecoded[ulLoop] && (ulCount < (ulLen - 1)); ulLoop++) { switch(pcDecoded[ulLoop]) { // // Pass most characters without modification. // default: { pcEncoded[ulCount++] = pcDecoded[ulLoop]; break; } case '/'': { ulCount += usnprintf(&pcEncoded[ulCount], (ulLen - ulCount), "'"); break; } } } return(ulCount);}
开发者ID:VENGEL,项目名称:StellarisWare,代码行数:65,
示例20: fs_map_path//*****************************************************************************////! Maps a path string containing mount point names to a path suitable for//! use in calls to the FatFs APIs.//!//! /param pcPath points to a string containing a path in the namespace//! defined by the mount information passed to fs_init().//! /param pcMapped points to a buffer into which the mapped path string will//! be written.//! /param iLen is the size, in bytes, of the buffer pointed to by pcMapped.//!//! This function may be used by applications which want to make use of FatFs//! functions which are not directly mapped by the fswrapper layer. A path//! in the namespace defined by the mount points passed to function fs_init()//! is translated to an equivalent path in the FatFs namespace and this may//! then be used in a direct call to functions such as f_opendir() or//! f_getfree().//!//! /return Returns /b true on success or /b false if fs_init() has not//! been called, if the path provided maps to an internal file system image//! rather than a FatFs logical drive or if the buffer pointed to by//! /e pcMapped is too small to fit the output string.////*****************************************************************************boolfs_map_path(const char *pcPath, char *pcMapped, int iLen){ char *pcFSFilename; uint32_t ui32MountIndex; int iCount; // // If no mount points have been defined, return an error. // if(!g_psMountPoints) { return(false); } // // Find which mount point we need to use to satisfy this file open request. // ui32MountIndex = fs_find_mount_index(pcPath, &pcFSFilename); // // If we got a bad mount index or the index returned represents a mount // point that is not in the FAT file system, return an error. // if((ui32MountIndex == BAD_MOUNT_INDEX) || (g_psMountPoints[ui32MountIndex].pui8FSImage)) { // // We can't map the mount index so return an error. // return(false); } // // Now we can generate the FatFs namespace path string. // iCount = usnprintf(pcMapped, iLen, "%d:%s", g_psMountPoints[ui32MountIndex].ui32DriveNum, pcFSFilename); // // Tell the user how we got on. The count returned by usnprintf is the // number of characters that should have been written, excluding the // terminating NULL so we use this to check for overflow of the output // buffer. // return((iLen >= (iCount + 1)) ? true : false);}
开发者ID:robotics-at-maryland,项目名称:qubo,代码行数:72,
示例21: umemsetuTCHAR *js_name_device(int dev) { static uTCHAR name[128]; uTCHAR path_dev[30]; int fd; umemset(name, 0x00, usizeof(name)); usnprintf(path_dev, usizeof(path_dev), uL("" JS_DEV_PATH "%d"), dev); fd = uopen(path_dev, O_RDONLY | O_NONBLOCK); if (uioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0) { ustrncpy(name, uL("Not connected"), usizeof(name)); } close(fd); return((uTCHAR *) name);}
开发者ID:punesemu,项目名称:puNES,代码行数:18,
示例22: CreateFileName//*****************************************************************************//// Create a file name for the file to be saved on the memory stick.// This function uses an incrementing numerical search scheme to determine// an available file name. It tries opening file names in succession until// it finds a file that does not yet exist.// The file name will be of the form LOGnnnn.CSV.// The caller supplies storage for the file name through the pcFilename// parameter.// The function will return 0 if successful and non-zero if a file name could// not be found.////*****************************************************************************static int32_tCreateFileName(char *pcFilename, uint32_t ui32Len){ FRESULT iFResult; uint32_t ui32FileNum = 0; // // Enter loop to search for available file name // do { // // Prepare a numerical based file name and attempt to open it // usnprintf(pcFilename, ui32Len, "LOG%04d.CSV", ui32FileNum); iFResult = f_open(&g_sFileObject, pcFilename, FA_OPEN_EXISTING); // // If file does not exist, then we have found a useable file name // if(iFResult == FR_NO_FILE) { // // Return to caller, indicating that a file name has been found. // return(0); } // // Otherwise, advance to the next number in the file name sequence. // ui32FileNum++; } while(ui32FileNum < 1000); // // If we reach this point, it means that no useable file name was found // after attempting 10000 file names. // return(1);}
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:54,
示例23: UpdateCountdown//*****************************************************************************//// Update the countdown text on the display prior to starting a new game.////*****************************************************************************voidUpdateCountdown(unsigned long ulCountdown){ short sX, sY; char pcCountdown[4]; // // Determine the position for the countdown text. // sX = GAME_AREA_LEFT + (GAME_AREA_WIDTH / 2); sY = GAME_AREA_TOP + 70; // // Render the countdown string. // usnprintf(pcCountdown, 4, " %d ", ulCountdown); // // Display it on the screen. // CenteredStringWithShadow(g_pFontCmss32b, pcCountdown, sX, sY, true);}
开发者ID:VENGEL,项目名称:StellarisWare,代码行数:27,
示例24: get_tag_insertstatic voidget_tag_insert(struct http_state *hs){ int loop; if(g_pfnSSIHandler && g_ppcTags && g_iNumTags) { /* Find this tag in the list we have been provided. */ for(loop = 0; loop < g_iNumTags; loop++) {#if USER_PROVIDES_ZERO_COPY_STATIC_TAGS if(strcmp(hs->tag_name, g_ppcTags[loop].pcCGIName) == 0) { hs->tag_insert_len = g_pfnSSIHandler(loop, 0, NULL, NULL, &(hs->tag_insert)); return; }#else if(strcmp(hs->tag_name, g_ppcTags[loop]) == 0) { hs->tag_insert_len = g_pfnSSIHandler(loop, hs->tag_insert, MAX_TAG_INSERT_LEN); return; }#endif } } /* If we drop out, we were asked to serve a page which contains tags that * we don't have a handler for. Merely echo back the tags with an error * marker. */#if USER_PROVIDES_ZERO_COPY_STATIC_TAGS hs->tag_insert = "<b>***UNKNOWN TAG***</b>";#else usnprintf(hs->tag_insert, (MAX_TAG_INSERT_LEN + 1), "<b>***UNKNOWN TAG %s***</b>", hs->tag_name);#endif hs->tag_insert_len = strlen(hs->tag_insert);}
开发者ID:gvb,项目名称:quickstart,代码行数:38,
示例25: GameOver//*****************************************************************************//// Update the high score if necessary then repaint the display to show the// "Game Over" information.////*****************************************************************************voidGameOver(int iLastScore){ // // See if the high score needs to be updated. // g_bNewHighScore = (iLastScore > g_iHighScore) ? true : false; g_iHighScore = g_bNewHighScore ? iLastScore : g_iHighScore; // // Update the score if necessary. // if (iLastScore != g_iCurScore) { usnprintf(g_pcScore, MAX_SCORE_LEN, " %d ", iLastScore); WidgetPaint((tWidget *)&g_sScore); g_iCurScore = iLastScore; } // // Update the display. // WidgetPaint((tWidget *)&g_sStoppedCanvas);}
开发者ID:VENGEL,项目名称:StellarisWare,代码行数:30,
示例26: main//.........这里部分代码省略......... // 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. // DisplayStatus(&g_sContext, "Configuring USB"); // // Initialize the transmit and receive buffers. // USBBufferInit(&g_sTxBuffer); USBBufferInit(&g_sRxBuffer); // // 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. // DisplayStatus(&g_sContext, "Waiting for host"); // // Clear our local byte counters. // ui32RxCount = 0; ui32TxCount = 0; // // Main application loop. // while(1) { // // Have we been asked to update the status display? // if(g_ui32Flags & COMMAND_STATUS_UPDATE) { // // Clear the command flag // g_ui32Flags &= ~COMMAND_STATUS_UPDATE; DisplayStatus(&g_sContext, g_pcStatus); } // // Has there been any transmit traffic since we last checked? // if(ui32TxCount != g_ui32TxCount) { // // Take a snapshot of the latest transmit count. // ui32TxCount = g_ui32TxCount; // // Update the display of bytes transmitted by the UART. // usnprintf(pcBuffer, 16, " %d ", ui32TxCount); GrStringDraw(&g_sContext, pcBuffer, -1, 48, 32, true); } // // Has there been any receive traffic since we last checked? // if(ui32RxCount != g_ui32RxCount) { // // Take a snapshot of the latest receive count. // ui32RxCount = g_ui32RxCount; // // Update the display of bytes received by the UART. // usnprintf(pcBuffer, 16, " %d ", ui32RxCount); GrStringDraw(&g_sContext, pcBuffer, -1, 48, 42, true); } }}
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,
示例27: main//.........这里部分代码省略......... // // Pass our device information to the USB library and place the device // on the bus. // USBDCDCInit(0, &g_sCDCDevice); // // Wait for initial configuration to complete. // DisplayStatus(&g_sContext, "Waiting for host"); // // Clear our local byte counters. // ui32RxCount = 0; ui32TxCount = 0; // // Enable interrupts now that the application is ready to start. // ROM_IntEnable(USB_UART_INT); // // Main application loop. // while(1) { // // Have we been asked to update the status display? // if(g_ui32Flags & COMMAND_STATUS_UPDATE) { // // Clear the command flag // ROM_IntMasterDisable(); g_ui32Flags &= ~COMMAND_STATUS_UPDATE; ROM_IntMasterEnable(); DisplayStatus(&g_sContext, g_pcStatus); } // // Has there been any transmit traffic since we last checked? // if(ui32TxCount != g_ui32UARTTxCount) { // // Take a snapshot of the latest transmit count. // ui32TxCount = g_ui32UARTTxCount; // // Update the display of bytes transmitted by the UART. // usnprintf(pcBuffer, 16, "%d ", ui32TxCount); GrStringDraw(&g_sContext, pcBuffer, -1, 40, 12, true); // // Update the RX buffer fullness. Remember that the buffers are // named relative to the USB whereas the status display is from // the UART's perspective. The USB's receive buffer is the UART's // transmit buffer. // ui32Fullness = ((USBBufferDataAvailable(&g_sRxBuffer) * 100) / UART_BUFFER_SIZE); UpdateBufferMeter(&g_sContext, ui32Fullness, 40, 22); } // // Has there been any receive traffic since we last checked? // if(ui32RxCount != g_ui32UARTRxCount) { // // Take a snapshot of the latest receive count. // ui32RxCount = g_ui32UARTRxCount; // // Update the display of bytes received by the UART. // usnprintf(pcBuffer, 16, "%d ", ui32RxCount); GrStringDraw(&g_sContext, pcBuffer, -1, 40, 32, true); // // Update the TX buffer fullness. Remember that the buffers are // named relative to the USB whereas the status display is from // the UART's perspective. The USB's transmit buffer is the UART's // receive buffer. // ui32Fullness = ((USBBufferDataAvailable(&g_sTxBuffer) * 100) / UART_BUFFER_SIZE); UpdateBufferMeter(&g_sContext, ui32Fullness, 40, 42); } }}
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,
示例28: main//.........这里部分代码省略......... // on the bus. // USBDCDCInit(0, (tUSBDCDCDevice *)&g_sCDCDevice); // // Wait for initial configuration to complete. // DisplayStatus(&g_sContext, " Waiting for host... "); // // Clear our local byte counters. // ui32RxCount = 0; ui32TxCount = 0; g_ui32UARTTxCount = 0; g_ui32UARTRxCount = 0;#ifdef DEBUG g_ui32UARTRxErrors = 0;#endif // // Enable interrupts now that the application is ready to start. // ROM_IntEnable(INT_UART0); // // Main application loop. // while(1) { // // Have we been asked to update the status display? // if(HWREGBITW(&g_ui32Flags, FLAG_STATUS_UPDATE)) { // // Clear the command flag // HWREGBITW(&g_ui32Flags, FLAG_STATUS_UPDATE) = 0; DisplayStatus(&g_sContext, g_pcStatus); } // // Has there been any transmit traffic since we last checked? // if(ui32TxCount != g_ui32UARTTxCount) { // // Take a snapshot of the latest transmit count. // ui32TxCount = g_ui32UARTTxCount; // // Update the display of bytes transmitted by the UART. // usnprintf(pcBuffer, 16, "%d ", ui32TxCount); GrStringDraw(&g_sContext, pcBuffer, -1, 150, 80, true); // // Update the RX buffer fullness. Remember that the buffers are // named relative to the USB whereas the status display is from // the UART's perspective. The USB's receive buffer is the UART's // transmit buffer. // ui32Fullness = ((USBBufferDataAvailable(&g_sRxBuffer) * 100) / UART_BUFFER_SIZE); UpdateBufferMeter(&g_sContext, ui32Fullness, 150, 105); } // // Has there been any receive traffic since we last checked? // if(ui32RxCount != g_ui32UARTRxCount) { // // Take a snapshot of the latest receive count. // ui32RxCount = g_ui32UARTRxCount; // // Update the display of bytes received by the UART. // usnprintf(pcBuffer, 16, "%d ", ui32RxCount); GrStringDraw(&g_sContext, pcBuffer, -1, 150, 160, true); // // Update the TX buffer fullness. Remember that the buffers are // named relative to the USB whereas the status display is from // the UART's perspective. The USB's transmit buffer is the UART's // receive buffer. // ui32Fullness = ((USBBufferDataAvailable(&g_sTxBuffer) * 100) / UART_BUFFER_SIZE); UpdateBufferMeter(&g_sContext, ui32Fullness, 150, 185); } }}
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,
示例29: io_get_animation_speed_string//*****************************************************************************//// Get the current animation speed as an ASCII string.////*****************************************************************************voidio_get_animation_speed_string(char *pcBuf, int iBufLen){ usnprintf(pcBuf, iBufLen, "%d%%", g_ulAnimSpeed);}
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:10,
示例30: main//.........这里部分代码省略......... // the relevant pin high to do this. // ROM_SysCtlPeripheralEnable(USB_MUX_GPIO_PERIPH); ROM_GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN); ROM_GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_DEVICE); // // Enable the system tick. // ROM_SysTickPeriodSet(SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Show the application name on the display and UART output. // DEBUG_PRINT("/nStellaris USB bulk device example/n"); DEBUG_PRINT("---------------------------------/n/n"); // // Tell the user what we are up to. // DisplayStatus(&g_sContext, "Configuring USB..."); // // Initialize the transmit and receive buffers. // USBBufferInit((tUSBBuffer *)&g_sTxBuffer); USBBufferInit((tUSBBuffer *)&g_sRxBuffer); // // Pass our device information to the USB library and place the device // on the bus. // USBDBulkInit(0, (tUSBDBulkDevice *)&g_sBulkDevice); // // Wait for initial configuration to complete. // DisplayStatus(&g_sContext, "Waiting for host..."); // // Clear our local byte counters. // ulRxCount = 0; ulTxCount = 0; // // Main application loop. // while(1) { // // Have we been asked to update the status display? // if(g_ulFlags & COMMAND_STATUS_UPDATE) { // // Clear the command flag // g_ulFlags &= ~COMMAND_STATUS_UPDATE; DisplayStatus(&g_sContext, g_pcStatus); } // // Has there been any transmit traffic since we last checked? // if(ulTxCount != g_ulTxCount) { // // Take a snapshot of the latest transmit count. // ulTxCount = g_ulTxCount; // // Update the display of bytes transmitted by the UART. // usnprintf(pcBuffer, 16, "%d", ulTxCount); GrStringDraw(&g_sContext, pcBuffer, -1, 70, 70, true); } // // Has there been any receive traffic since we last checked? // if(ulRxCount != g_ulRxCount) { // // Take a snapshot of the latest receive count. // ulRxCount = g_ulRxCount; // // Update the display of bytes received by the UART. // usnprintf(pcBuffer, 16, "%d", ulRxCount); GrStringDraw(&g_sContext, pcBuffer, -1, 70, 90, true); } }}
开发者ID:Razofiter,项目名称:Luminary-Micro-Library,代码行数:101,
注:本文中的usnprintf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ustime函数代码示例 C++ usleep_range函数代码示例 |