这篇教程C++ GrContextForegroundSet函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GrContextForegroundSet函数的典型用法代码示例。如果您正苦于以下问题:C++ GrContextForegroundSet函数的具体用法?C++ GrContextForegroundSet怎么用?C++ GrContextForegroundSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GrContextForegroundSet函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SlideMenuRight//.........这里部分代码省略......... pMenuWidget->pSlideMenu = pChildMenu; // // Draw the new (child) menu into off-screen buffer A // SlideMenuDraw(pMenuWidget, &sContext, 0); } // // Process child widget of this menu item. This only happens if there // is no child menu. // else if(pChildWidget) { // // Call the widget activated callback function. This will notify // the application that a child widget has been activated by the // menu system. // if(pMenuWidget->pfnActive) { pMenuWidget->pfnActive(pChildWidget, &pMenu->pSlideMenuItems[pMenu->ulFocusIndex], 1); } // // Link the new child widget into this SlideMenuWidget so // it appears as a child to this widget. Normally the menu widget // has no child widget. // pWidget->pChild = pChildWidget; pChildWidget->pParent = pWidget; // // Fill a rectangle with the new child widget background color. // This is done in off-screen buffer A. When the menu slides off, // it will be replaced by a blank background that will then be // controlled by the new child widget. // GrContextForegroundSet( &sContext, pMenu->pSlideMenuItems[pMenu->ulFocusIndex].ulChildWidgetColor); GrRectFill(&sContext, &sContext.sClipRegion); // // Request a repaint for the child widget so it can draw itself once // the menu slide is done. // WidgetPaint(pChildWidget); } // // There is no child menu or child widget, so there is nothing to change // on the display. // else { return(1); } // // Initialize a drawing context for the display where the widget is to be // drawn. This is the physical display, not an off-screen buffer. // GrContextInit(&sContext, pWidget->pDisplay); // // Initialize the clipping region on the physical display, based on the // extents of this widget. // GrContextClipRegionSet(&sContext, &(pWidget->sPosition)); // // Get the width of the menu widget which is used in calculations below // ulMenuWidth = pMenuWidget->pDisplayA->usWidth; // // The following loop draws the two off-screen buffers onto the physical // display using a right-to-left-wipe. This will provide an appearance // of sliding to the left. The new child menu, or child widget background // will slide in from the right. The "old" menu is being held in // off-screen buffer B and the new one is in buffer A. So when we are // done, the correct image will be in buffer A. // for(uX = 0; uX <= ulMenuWidth; uX += 8) { GrImageDraw(&sContext, pMenuWidget->pDisplayB->pvDisplayData, pWidget->sPosition.sXMin - uX, pWidget->sPosition.sYMin); GrImageDraw(&sContext, pMenuWidget->pDisplayA->pvDisplayData, pWidget->sPosition.sXMin + ulMenuWidth - uX, pWidget->sPosition.sYMin); } // // Return indication that we handled the key event. // return(1);}
开发者ID:hakkinen86,项目名称:Luminary-Micro-Library,代码行数:101,
示例2: _task_LCD/** Task for updating the LCD display every 16ms.*/Void _task_LCD(UArg arg0, UArg arg1){ // create the LCD context tContext g_sContext; // initialize LCD driver Kentec320x240x16_SSD2119Init(120000000); // initialize graphics context GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119); // draw application frame FrameDraw(&g_sContext, "Festo Station"); uint32_t EventPosted; DisplayMessage MessageObject; char StringBuffer[100]; tRectangle ClearRect; ClearRect.i16XMax = 320; ClearRect.i16XMin = 0; ClearRect.i16YMax = 240; ClearRect.i16YMin = 0; while(1) { EventPosted = Event_pend(DisplayEvents, Event_Id_NONE, Event_Id_00, 10); if (EventPosted & Event_Id_00) { if (Mailbox_pend(DisplayMailbox, &MessageObject, BIOS_NO_WAIT)) { GrContextForegroundSet(&g_sContext, 0x00); GrRectFill(&g_sContext, &ClearRect); if (MessageObject.ScreenID == 0) { FrameDraw(&g_sContext, "Festo Station - Stopped"); GrStringDraw(&g_sContext, "Press [Up] to start.", -1, 10, 30, 0); GrStringDraw(&g_sContext, "Press [Down] to stop.", -1, 10, 50, 0); GrStringDraw(&g_sContext, "Press [Select] to calibrate.", -1, 10, 70, 0); //Footer sprintf(StringBuffer, "Uptime: %d [s]", MessageObject.uptimeSeconds); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 180, 0); sprintf(StringBuffer, "Time: %s", MessageObject.timeString); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 200, 0); } if (MessageObject.ScreenID == 1) { FrameDraw(&g_sContext, "Festo Station - Running"); sprintf(StringBuffer, "Pieces processed = %d", MessageObject.piecesProcessed); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 30, 0); sprintf(StringBuffer, "Orange A/R = %d/%d", MessageObject.orangeAccepted, MessageObject.orangeRejected); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 50, 0); sprintf(StringBuffer, "Black A/R = %d/%d", MessageObject.blackAccepted, MessageObject.blackRejected); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 70, 0); sprintf(StringBuffer, "Plastic A/R = %d/%d", MessageObject.plasticAccepted, MessageObject.plasticRejected); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 90, 0); sprintf(StringBuffer, "Metallic Accepted/Rejected = %d/%d", MessageObject.metalAccepted, MessageObject.metalRejected); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 110, 0); sprintf(StringBuffer, "Pieces processed/min = %.2f [p/min]", (float) 0.01 * MessageObject.piecesProcessedPerSecond); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 130, 0); //Footer sprintf(StringBuffer, "Uptime: %d [s]", MessageObject.uptimeSeconds); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 180, 0); sprintf(StringBuffer, "Time: %s", MessageObject.timeString); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 200, 0); } if (MessageObject.ScreenID == 2) { FrameDraw(&g_sContext, "Festo Station - Calibration"); GrStringDraw(&g_sContext, "Initializing Calibration...", -1, 10, 30, 0); //Footer sprintf(StringBuffer, "Uptime: %d [s]", MessageObject.uptimeSeconds); GrStringDraw(&g_sContext, StringBuffer, -1, 10, 180, 0); sprintf(StringBuffer, "Time: %s", MessageObject.timeString);//.........这里部分代码省略.........
开发者ID:spamish,项目名称:ENB350,代码行数:101,
示例3: main//*****************************************************************************//// A simple demonstration of the features of the Stellaris Graphics Library.////*****************************************************************************intmain(void){ tContext sContext; tRectangle sRect; // // The FPU should be enabled because some compilers will use floating- // point registers, even for non-floating-point code. If the FPU is not // enabled this will cause a fault. This also ensures that floating- // point operations could be added to this application and would work // correctly and use the hardware floating-point unit. Finally, lazy // stacking is enabled 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 clock to 40Mhz derived from the PLL and the external oscillator // SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(); // // Initialize the graphics context. // GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119); // // 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_sFontCm20); GrStringDrawCentered(&sContext, "grlib demo", -1, GrContextDpyWidthGet(&sContext) / 2, 8, 0); // // Configure and enable uDMA // SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); SysCtlDelay(10); uDMAControlBaseSet(&sDMAControlTable[0]); uDMAEnable(); // // Initialize the touch screen driver and have it route its messages to the // widget tree. // TouchScreenInit(); TouchScreenCallbackSet(WidgetPointerMessage); // // Add the title block and the previous and next buttons to the widget // tree. // WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sPrevious); WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sTitle); WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sNext); // // Add the first panel to the widget tree. // g_ulPanel = 0; WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels); CanvasTextSet(&g_sTitle, g_pcPanelNames[0]); // // Issue the initial paint request to the widgets. // WidgetPaint(WIDGET_ROOT); // // Loop forever handling widget messages.//.........这里部分代码省略.........
开发者ID:xolalpay,项目名称:CPE403-TIVAC-LABS,代码行数:101,
示例4: main//*****************************************************************************//// Provides a scribble pad using the display on the Intelligent Display Module.////*****************************************************************************intmain(void){ uint32_t 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(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(ui32SysClock); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&g_sContext, "scribble"); // // Print the instructions across the top of the screen in white with a 20 // point san-serif font. // GrContextForegroundSet(&g_sContext, ClrWhite); GrContextFontSet(&g_sContext, g_psFontCmss20); GrStringDrawCentered(&g_sContext, "Touch the screen to draw", -1, GrContextDpyWidthGet(&g_sContext) / 2, ((GrContextDpyHeightGet(&g_sContext) - 32) / 2) + 14, 0); // // Flush any cached drawing operations. // GrFlush(&g_sContext); // // Set the color index to zero. // g_ui32ColorIdx = 0; // // Initialize the message queue we use to pass messages from the touch // interrupt handler context to the main loop for processing. // RingBufInit(&g_sMsgQueue, (uint8_t *)g_psMsgQueueBuffer, (MSG_QUEUE_SIZE * sizeof(tScribbleMessage))); // // Initialize the touch screen driver. // TouchScreenInit(ui32SysClock); // // Set the touch screen event handler. // TouchScreenCallbackSet(TSHandler); // // Loop forever. All the drawing is done in the touch screen event // handler. // while(1) { // // Process any new touchscreen messages. // ProcessTouchMessages(); }}
开发者ID:peterliu2,项目名称:tivaWare,代码行数:86,
示例5: USBHCDEvents//*****************************************************************************//// This is the generic callback from host stack.//// pvData is actually a pointer to a tEventInfo structure.//// This function will be called to inform the application when a USB event has// occurred that is outside those related to the mouse device. At this// point this is used to detect unsupported devices being inserted and removed.// It is also used to inform the application when a power fault has occurred.// This function is required when the g_USBGenericEventDriver is included in// the host controller driver array that is passed in to the// USBHCDRegisterDrivers() function.////*****************************************************************************voidUSBHCDEvents(void *pvData){ tEventInfo *pEventInfo; tRectangle sRect; // // Fill the bottom rows of the screen with blue to create the status area. // sRect.i16XMin = 0; sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - DISPLAY_BANNER_HEIGHT - 1; sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT; GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Set the font for the status message // GrContextFontSet(&g_sContext, g_psFontFixed6x8); // // Cast this pointer to its actual type. // pEventInfo = (tEventInfo *)pvData; switch(pEventInfo->ui32Event) { // // New mouse detected. // case USB_EVENT_CONNECTED: { // // See if this is a HID Mouse. // if((USBHCDDevClass(pEventInfo->ui32Instance, 0) == USB_CLASS_HID) && (USBHCDDevProtocol(pEventInfo->ui32Instance, 0) == USB_HID_PROTOCOL_MOUSE)) { // // Indicate that the mouse has been detected. // GrStringDrawCentered(&g_sContext, "Mouse Connected", -1, GrContextDpyWidthGet(&g_sContext) / 2, sRect.i16YMin + 5, 0); // // Set initial mouse information. // GrStringDrawCentered(&g_sContext, "0,0", -1, GrContextDpyWidthGet(&g_sContext) / 2, 26, 1); GrStringDrawCentered(&g_sContext, "000", -1, GrContextDpyWidthGet(&g_sContext) / 2, 46, 1); // // Proceed to the STATE_MOUSE_INIT state so that the main loop // can finish initialized the mouse since USBHMouseInit() // cannot be called from within a callback. // g_eUSBState = STATE_MOUSE_INIT; } break; } // // Unsupported device detected. // case USB_EVENT_UNKNOWN_CONNECTED: { GrStringDrawCentered(&g_sContext, "Unknown Device", -1, GrContextDpyWidthGet(&g_sContext) / 2, sRect.i16YMin + 5, 0); // // An unknown device was detected. // g_eUSBState = STATE_UNKNOWN_DEVICE;//.........这里部分代码省略.........
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,
示例6: OnIntroPaint//*****************************************************************************//// Handles paint requests for the introduction canvas widget.////*****************************************************************************voidOnIntroPaint(tWidget *psWidget, tContext *psContext){ tRectangle sRect; // // Display the introduction text in the canvas. // GrContextFontSet ( psContext, g_psFontCm16); GrContextForegroundSet ( psContext, ClrSilver); GrStringDraw(psContext, "OUTPUTS", -1, 125, LOC_Y_0UTPUTS-50, 0); GrStringDraw(psContext, "0", -1, LOC_X_0-4, LOC_Y_0UTPUTS-35, 0); GrStringDraw(psContext, "1", -1, LOC_X_1-4, LOC_Y_0UTPUTS-35, 0); GrStringDraw(psContext, "2", -1, LOC_X_2-4, LOC_Y_0UTPUTS-35, 0); GrStringDraw(psContext, "3", -1, LOC_X_3-4, LOC_Y_0UTPUTS-35, 0); GrStringDraw(psContext, "4", -1, LOC_X_4-4, LOC_Y_0UTPUTS-35, 0); GrStringDraw(psContext, "5", -1, LOC_X_5-4, LOC_Y_0UTPUTS-35, 0); GrStringDraw(psContext, "6", -1, LOC_X_6-4, LOC_Y_0UTPUTS-35, 0); GrStringDraw(psContext, "7", -1, LOC_X_7-4, LOC_Y_0UTPUTS-35, 0); WidgetAdd((tWidget *)&g_sBackground, (tWidget *)&g_sPushBtn_0); WidgetAdd((tWidget *)&g_sBackground, (tWidget *)&g_sPushBtn_1); WidgetAdd((tWidget *)&g_sBackground, (tWidget *)&g_sPushBtn_2); WidgetAdd((tWidget *)&g_sBackground, (tWidget *)&g_sPushBtn_3); WidgetAdd((tWidget *)&g_sBackground, (tWidget *)&g_sPushBtn_4); WidgetAdd((tWidget *)&g_sBackground, (tWidget *)&g_sPushBtn_5); WidgetAdd((tWidget *)&g_sBackground, (tWidget *)&g_sPushBtn_6); WidgetAdd((tWidget *)&g_sBackground, (tWidget *)&g_sPushBtn_7); GrStringDraw(psContext, "INPUTS", -1, 130, LOC_Y_INPUTS-50, 0); GrStringDraw(psContext, "0", -1, LOC_X_0-4, LOC_Y_INPUTS-35, 0); GrStringDraw(psContext, "1", -1, LOC_X_1-4, LOC_Y_INPUTS-35, 0); GrStringDraw(psContext, "2", -1, LOC_X_2-4, LOC_Y_INPUTS-35, 0); GrStringDraw(psContext, "3", -1, LOC_X_3-4, LOC_Y_INPUTS-35, 0); GrStringDraw(psContext, "4", -1, LOC_X_4-4, LOC_Y_INPUTS-35, 0); GrStringDraw(psContext, "5", -1, LOC_X_5-4, LOC_Y_INPUTS-35, 0); GrStringDraw(psContext, "6", -1, LOC_X_6-4, LOC_Y_INPUTS-35, 0); GrStringDraw(psContext, "7", -1, LOC_X_7-4, LOC_Y_INPUTS-35, 0); //Draw all INPUT status circles //TBD Cant get a loop to work for this for some reason GrContextForegroundSet( psContext, ClrCyan); if ( input_status[0] == INPUT_STATUS_IS_ONE ){ GrContextForegroundSet( psContext, ClrRed); } GrCircleFill( psContext, LOC_X_0, LOC_Y_INPUTS, 15); GrContextForegroundSet( psContext, ClrCyan); if ( input_status[1] == INPUT_STATUS_IS_ONE ){ GrContextForegroundSet( psContext, ClrRed); } GrCircleFill( psContext, LOC_X_1, LOC_Y_INPUTS, 15); GrContextForegroundSet( psContext, ClrCyan); if ( input_status[2] == INPUT_STATUS_IS_ONE ){ GrContextForegroundSet( psContext, ClrRed); } GrCircleFill( psContext, LOC_X_2, LOC_Y_INPUTS, 15); GrContextForegroundSet( psContext, ClrCyan); if ( input_status[3] == INPUT_STATUS_IS_ONE ){ GrContextForegroundSet( psContext, ClrRed); } GrCircleFill( psContext, LOC_X_3, LOC_Y_INPUTS, 15); GrContextForegroundSet( psContext, ClrCyan); if ( input_status[4] == INPUT_STATUS_IS_ONE ){ GrContextForegroundSet( psContext, ClrRed); } GrCircleFill( psContext, LOC_X_4, LOC_Y_INPUTS, 15); GrContextForegroundSet( psContext, ClrCyan); if ( input_status[5] == INPUT_STATUS_IS_ONE ){ GrContextForegroundSet( psContext, ClrRed); } GrCircleFill( psContext, LOC_X_5, LOC_Y_INPUTS, 15); GrContextForegroundSet( psContext, ClrCyan); if ( input_status[6] == INPUT_STATUS_IS_ONE ){ GrContextForegroundSet( psContext, ClrRed); } GrCircleFill( psContext, LOC_X_6, LOC_Y_INPUTS, 15); GrContextForegroundSet( psContext, ClrCyan); if ( input_status[7] == INPUT_STATUS_IS_ONE ){ GrContextForegroundSet( psContext, ClrRed); } GrCircleFill( psContext, LOC_X_7, LOC_Y_INPUTS, 15); GrContextForegroundSet ( psContext, ClrSilver); GrStringDraw(psContext, "ANALOG", -1, 130, LOC_Y_ANALOG-30, 0);//.........这里部分代码省略.........
开发者ID:spamish,项目名称:ENB350,代码行数:101,
示例7: main//*****************************************************************************//// A simple application demonstrating use of the boot loader,////*****************************************************************************intmain(void){ uint32_t ui32SysClock; tContext sContext; tRectangle sRect; // // 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(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(ui32SysClock); // // Initialize the graphics context. // GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&sContext, "boot-demo-uart"); // // Print instructions on the screen. // GrStringDrawCentered(&sContext, "Press the screen to start", -1, 160, 108, false); GrStringDrawCentered(&sContext, "the update process", -1, 160, 128, false); // // Initialize the touch screen driver. // TouchScreenInit(ui32SysClock); // // Set the touch screen event handler. // TouchScreenCallbackSet(TSHandler); // // Enable the UART that will be used for the firmware update. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // // Configure the UART for 115200, 8-N-1. // ROM_UARTConfigSetExpClk(UART0_BASE, ui32SysClock, 115200, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8)); // // Enable the UART operation. // ROM_UARTEnable(UART0_BASE); // // Wait until the screen has been pressed, indicating that the firwmare // update should begin. // while(!g_bFirmwareUpdate) { } // // Clear the screen. // sRect.i16XMin = 0; sRect.i16YMin = 0; sRect.i16XMax = 319; sRect.i16YMax = 239; GrContextForegroundSet(&sContext, ClrBlack); GrRectFill(&sContext, &sRect); // // Indicate that the firmware update is about to start. // GrContextForegroundSet(&sContext, ClrWhite); GrStringDrawCentered(&sContext, "Update process started...", -1, 160, 98, false); GrStringDrawCentered(&sContext, "Using UART0 with", -1, 160, 138, false); GrStringDrawCentered(&sContext, "115,200 baud, 8-N-1.", -1, 160, 158, false);//.........这里部分代码省略.........
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:101,
示例8: main//*****************************************************************************//// This is the main loop that runs the application.////*****************************************************************************intmain(void){ uint_fast32_t ui32LastTickCount; bool bLastSuspend; tRectangle sRect; tContext sContext; int_fast32_t i32CenterX; // // 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); // // Configure the required pins for USB operation. // 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); // // Erratum workaround for silicon revision A1. VBUS must have pull-down. // if(CLASS_IS_BLIZZARD && REVISION_IS_A1) { HWREG(GPIO_PORTB_BASE + GPIO_O_PDR) |= GPIO_PIN_1; } // // Enable the GPIO that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2); ROM_GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, 0); // // Initialize the buttons driver // ButtonsInit(); // // Initialize the display driver. // CFAL96x64x16Init(); // // Initialize the graphics context and find the middle X coordinate. // GrContextInit(&sContext, &g_sCFAL96x64x16); i32CenterX = GrContextDpyWidthGet(&sContext) / 2; // // Fill the top part of the screen with blue to create the banner. // sRect.i16XMin = 0; sRect.i16YMin = 0; sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; sRect.i16YMax = 9; GrContextForegroundSet(&sContext, ClrDarkBlue); GrRectFill(&sContext, &sRect); // // Change foreground for white text. // GrContextForegroundSet(&sContext, ClrWhite); // // Put the application name in the middle of the banner. // GrContextFontSet(&sContext, g_psFontFixed6x8); GrStringDrawCentered(&sContext, "usb-dev-keyboard", -1, i32CenterX, 4, 0); // // Not configured initially. // g_bConnected = false; g_bSuspended = false; bLastSuspend = false; // // Initialize the USB stack for device mode. ////.........这里部分代码省略.........
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,
示例9: main//*****************************************************************************//// Demonstrate the use of the boot loader.////*****************************************************************************intmain(void){ tRectangle sRect; // // Set the clocking to run directly from the crystal. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // // If running on Rev A0 silicon, write the FMPRE[2-3]/FMPPE[2-3] registers // to zero. This is a workaround to allow the mass erase in the ROM-based // boot loader to succeed if a locked device recovery has been performed. // if(REVISION_IS_A0) { HWREG(FLASH_FMPPE2) = 0; HWREG(FLASH_FMPPE3) = 0; HWREG(FLASH_FMPRE2) = 0; HWREG(FLASH_FMPRE3) = 0; } // // Enable the UART and GPIO modules. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // // Make the UART pins be peripheral controlled. // ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Configure the UART for 115,200, 8-N-1 operation. // ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // // Initialize the display driver. // Formike128x128x16Init(); // // Turn on the backlight. // Formike128x128x16BacklightOn(); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sFormike128x128x16); // // Fill the top 15 rows of the screen with blue to create the banner. // sRect.sXMin = 0; sRect.sYMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = 14; GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, &g_sFontFixed6x8); GrStringDrawCentered(&g_sContext, "boot_demo1", -1, GrContextDpyWidthGet(&g_sContext) / 2, 7, 0); // // Indicate what is happening. // GrStringDrawCentered(&g_sContext, "The boot loader is", -1, GrContextDpyWidthGet(&g_sContext) / 2, 24, 0); GrStringDrawCentered(&g_sContext, "now running and", -1, GrContextDpyWidthGet(&g_sContext) / 2, 32, 0); GrStringDrawCentered(&g_sContext, "awaiting an update", -1, GrContextDpyWidthGet(&g_sContext) / 2, 40, 0); GrStringDrawCentered(&g_sContext, "over UART0 at", -1, GrContextDpyWidthGet(&g_sContext) / 2, 48, 0); GrStringDrawCentered(&g_sContext, "115200, 8-N-1.", -1, GrContextDpyWidthGet(&g_sContext) / 2, 56, 0); ////.........这里部分代码省略.........
开发者ID:fejerson108,项目名称:Stellarisware,代码行数:101,
示例10: main//*****************************************************************************//// Demonstrate the use of the USB stick update example.////*****************************************************************************intmain(void){ uint_fast32_t ui32Count; 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 system clock to run at 50MHz from the PLL. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // 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 = 9; 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_psFontFixed6x8); GrStringDrawCentered(&sContext, "usb-stick-demo", -1, GrContextDpyWidthGet(&sContext) / 2, 4, 0); // // Indicate what is happening. // GrStringDrawCentered(&sContext, "Press the", -1, GrContextDpyWidthGet(&sContext) / 2, 20, 0); GrStringDrawCentered(&sContext, "select button to", -1, GrContextDpyWidthGet(&sContext) / 2, 30, 0); GrStringDrawCentered(&sContext, "start the USB", -1, GrContextDpyWidthGet(&sContext) / 2, 40, 0); GrStringDrawCentered(&sContext, "stick updater.", -1, GrContextDpyWidthGet(&sContext) / 2, 50, 0); // // Flush any cached drawing operations. // GrFlush(&sContext); // // Enable the GPIO module which the select button is attached to. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM); // // Enable the GPIO pin to read the user button. // ROM_GPIODirModeSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_DIR_MODE_IN); MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); // // Wait for the pullup to take effect or the next loop will exist too soon. // SysCtlDelay(1000); // // Wait until the select button has been pressed for ~40ms (in order to // debounce the press). // ui32Count = 0; while(1) { ////.........这里部分代码省略.........
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,
示例11: ContainerPaint//*****************************************************************************////! Draws a container widget.//!//! /param pWidget is a pointer to the container widget to be drawn.//!//! This function draws a container widget on the display. This is called in//! response to a /b #WIDGET_MSG_PAINT message.//!//! /return None.////*****************************************************************************static voidContainerPaint(tWidget *pWidget){ tContainerWidget *pContainer; long lX1, lX2, lY; tContext sCtx; // // Check the arguments. // ASSERT(pWidget); // // Convert the generic widget pointer into a container widget pointer. // pContainer = (tContainerWidget *)pWidget; // // Initialize a drawing context. // GrContextInit(&sCtx, pWidget->pDisplay); // // Initialize the clipping region based on the extents of this container. // GrContextClipRegionSet(&sCtx, &(pWidget->sPosition)); // // See if the container fill style is selected. // if(pContainer->ulStyle & CTR_STYLE_FILL) { // // Fill the container with the fill color. // GrContextForegroundSet(&sCtx, pContainer->ulFillColor); GrRectFill(&sCtx, &(pWidget->sPosition)); } // // See if the container text style is selected. // if(pContainer->ulStyle & CTR_STYLE_TEXT) { // // Set the font and colors used to draw the container text. // GrContextFontSet(&sCtx, pContainer->pFont); GrContextForegroundSet(&sCtx, pContainer->ulTextColor); GrContextBackgroundSet(&sCtx, pContainer->ulFillColor); // // Get the width of the container text. // lX2 = GrStringWidthGet(&sCtx, pContainer->pcText, -1); // // Determine the position of the text. The position depends on the // the width of the string and if centering is enabled. // if(pContainer->ulStyle & CTR_STYLE_TEXT_CENTER) { lX1 = (pWidget->sPosition.sXMin + ((pWidget->sPosition.sXMax - pWidget->sPosition.sXMin + 1 - lX2 - 8) / 2)); } else { lX1 = pWidget->sPosition.sXMin + 4; } // // Draw the container text. // GrStringDraw(&sCtx, pContainer->pcText, -1, lX1 + 4, pWidget->sPosition.sYMin, pContainer->ulStyle & CTR_STYLE_TEXT_OPAQUE); // // See if the container outline style is selected. // if(pContainer->ulStyle & CTR_STYLE_OUTLINE) { // // Get the position of the right side of the string. // lX2 = lX1 + lX2 + 8;//.........这里部分代码省略.........
开发者ID:alkyl1978,项目名称:LM4F120,代码行数:101,
示例12: 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:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:85,
示例13: main//.........这里部分代码省略......... RasterDMAFBConfig(SOC_LCDC_0_REGS, (unsigned int)(g_pucBuffer+PALETTE_OFFSET), (unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET, 1); // Copy palette info into buffer src = (unsigned char *) palette_32b; dest = (unsigned char *) (g_pucBuffer+PALETTE_OFFSET); for( i = 4; i < (PALETTE_SIZE+4); i++) { *dest++ = *src++; } GrOffScreen16BPPInit(&g_sSHARP480x272x16Display, g_pucBuffer, LCD_WIDTH, LCD_HEIGHT); // Initialize a drawing context. GrContextInit(&g_sContext, &g_sSHARP480x272x16Display); /* enable End of frame interrupt */ RasterEndOfFrameIntEnable(SOC_LCDC_0_REGS); /* enable raster */ RasterEnable(SOC_LCDC_0_REGS); ConfigRasterDisplayEnable(); // // Fill the top 15 rows of the screen with blue to create the banner. // sRect.sXMin = 0; sRect.sYMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = DISPLAY_BANNER_HEIGHT; GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, &g_sFontCm20); GrStringDrawCentered(&g_sContext, "usb-dev-msc", -1, GrContextDpyWidthGet(&g_sContext) / 2, 10, 0); // // Initialize the idle timeout and reset all flags. // g_ulIdleTimeout = 0; g_ulFlags = 0; // // Initialize the state to idle. // g_eMSCState = MSC_DEV_IDLE; // // Draw the status bar and set it to idle. // UpdateStatus("Idle", 1);#endif
开发者ID:ev3rt-git,项目名称:ev3rt-hrp3,代码行数:66,
示例14: SlideMenuLeft//*****************************************************************************////! Performs the sliding menu operation, in response to the "left" button.//!//! /param pWidget is a pointer to the slide menu widget to move to the left.//!//! This function will respond to the "left" key/button event. The left//! button is used to ascend to the next menu up in the menu tree. The effect//! is that the current menu, or active widget, slides off to the right, while//! the parent menu slides in from the left.//!//! This function repeatedly draws the menu onto the display until the sliding//! animation is finished and will not return to the caller until then. This//! function is usually called from the thread context of//! WidgetMessageQueueProcess().//!//! /return Returns a non-zero value if the menu was moved or was not moved//! because it is already at the last position. If a child widget is active//! then this function does nothing and returns a 0.////*****************************************************************************static longSlideMenuLeft(tWidget *pWidget){ tSlideMenuWidget *pMenuWidget; tSlideMenu *pMenu; tSlideMenu *pParentMenu; tContext sContext; unsigned int uX; unsigned long ulMenuWidth; // // Get handy pointers to the menu widget and active menu, and the parent // menu if there is one. // pMenuWidget = (tSlideMenuWidget *)pWidget; pMenu = pMenuWidget->pSlideMenu; pParentMenu = pMenu->pParent; // // Initialize a context for the primary off-screen drawing buffer. // Clip region is set to entire display by default, which is what we want. // GrContextInit(&sContext, pMenuWidget->pDisplayB); // // If this widget has a child, that means that the child widget is in // control, and we are requested to go back to the previous menu item. // Process the child widget. // if(pWidget->pChild) { // // Call the widget de-activated callback function. This notifies the // application that the widget is being deactivated. // if(pMenuWidget->pfnActive) { pMenuWidget->pfnActive(pWidget->pChild, &pMenu->pSlideMenuItems[pMenu->ulFocusIndex], 0); } // // Unlink the child widget from the slide menu widget. The menu // widget will now no longer have a child widget. // pWidget->pChild->pParent = 0; pWidget->pChild = 0; // // Fill a rectangle with the child widget background color. This will // erase everything else that is shown on the widget but leave the // background, which will make the change visually less jarring. // This is done in off-screen buffer B, which is the buffer that is // going to be slid off the screen. // GrContextForegroundSet( &sContext, pMenu->pSlideMenuItems[pMenu->ulFocusIndex].ulChildWidgetColor); GrRectFill(&sContext, &sContext.sClipRegion); } // // Otherwise there is not a child widget in control, so process the parent // menu, if there is one. // else if(pParentMenu) { // // Render the current menu into the off-screen buffer B. This will be // the same menu appearance that is currently on the display. // SlideMenuDraw(pMenuWidget, &sContext, 0); // // Now switch the widget to the parent menu // pMenuWidget->pSlideMenu = pParentMenu; }//.........这里部分代码省略.........
开发者ID:hakkinen86,项目名称:Luminary-Micro-Library,代码行数:101,
示例15: JPEGWidgetPaint//*****************************************************************************//// Draws a JPEG widget.//// /param pWidget is a pointer to the JPEG widget to be drawn.//// This function draws a JPEG widget on the display. This is called in// response to a /b WIDGET_MSG_PAINT message.//// /return None.////*****************************************************************************static voidJPEGWidgetPaint(tWidget *pWidget){ tRectangle sRect; tJPEGWidget *pJPEG; tContext sCtx; unsigned short usWidth, usHeight, usRow; unsigned short *pusRow; short sSrcX, sSrcY, sDstX, sDstY; // // Check the arguments. // ASSERT(pWidget); // // Convert the generic widget pointer into a JPEG widget pointer. // pJPEG = (tJPEGWidget *)pWidget; // // Initialize a drawing context. // GrContextInit(&sCtx, pWidget->pDisplay); // // Initialize the clipping region based on the extents of this rectangular // JPEG widget. // GrContextClipRegionSet(&sCtx, &(pWidget->sPosition)); // // Take a copy of the current widget position. // sRect=pWidget->sPosition; // // See if the JPEG widget outline style is selected. // if(pJPEG->ulStyle & JW_STYLE_OUTLINE) { unsigned long ulLoop; GrContextForegroundSet(&sCtx, pJPEG->ulOutlineColor); // // Outline the JPEG widget with the outline color. // for(ulLoop = 0; ulLoop < (unsigned long)pJPEG->ucBorderWidth; ulLoop++) { GrRectDraw(&sCtx, &sRect); sRect.sXMin++; sRect.sYMin++; sRect.sXMax--; sRect.sYMax--; } } // // If the fill style is selected fill the widget with the appropriate color. // if(pJPEG->ulStyle & JW_STYLE_FILL) { // // Fill the JPEG widget with the fill color. // GrContextForegroundSet(&sCtx, pJPEG->ulFillColor); GrRectFill(&sCtx, &(pWidget->sPosition)); } // // Does the widget had a decompressed image to draw? // if(pJPEG->psJPEGInst->pusImage) { // // What is the size of the image area of the widget? // usWidth = (sRect.sXMax - sRect.sXMin) + 1; usHeight = (sRect.sYMax - sRect.sYMin) + 1; // // Is the display window wider than the image? // if(usWidth > pJPEG->psJPEGInst->usWidth) { // // The display window is wider so we need to center the image//.........这里部分代码省略.........
开发者ID:hitubaldaniya,项目名称:lumweb,代码行数:101,
示例16: DrawBlackKeys//*****************************************************************************//// Draws the black keys on the display.////*****************************************************************************static inline voidDrawBlackKeys(tContext *pContext){ uint32_t ui32Key; // // Loop through the black keys. // for(ui32Key = 0; ui32Key < NUM_BLACK_KEYS; ui32Key++) { // // Select the color for the top and left edges of the black key. // GrContextForegroundSet(pContext, ClrBlackBright); // // Draw the top and left edges of the black key. // GrLineDraw(pContext, g_psBlackKeys[ui32Key].sOutline.i16XMin, g_psBlackKeys[ui32Key].sOutline.i16YMin, g_psBlackKeys[ui32Key].sOutline.i16XMax, g_psBlackKeys[ui32Key].sOutline.i16YMin); GrLineDraw(pContext, g_psBlackKeys[ui32Key].sOutline.i16XMin + 1, g_psBlackKeys[ui32Key].sOutline.i16YMin + 1, g_psBlackKeys[ui32Key].sOutline.i16XMax - 1, g_psBlackKeys[ui32Key].sOutline.i16YMin + 1); GrLineDraw(pContext, g_psBlackKeys[ui32Key].sOutline.i16XMin, g_psBlackKeys[ui32Key].sOutline.i16YMin + 1, g_psBlackKeys[ui32Key].sOutline.i16XMin, g_psBlackKeys[ui32Key].sOutline.i16YMax); GrLineDraw(pContext, g_psBlackKeys[ui32Key].sOutline.i16XMin + 1, g_psBlackKeys[ui32Key].sOutline.i16YMin + 2, g_psBlackKeys[ui32Key].sOutline.i16XMin + 1, g_psBlackKeys[ui32Key].sOutline.i16YMax - 1); // // Select the color for the bottom and right edges of the black key. // GrContextForegroundSet(pContext, ClrBlackDim); // // Draw the bottom and right edges of the black key. // GrLineDraw(pContext, g_psBlackKeys[ui32Key].sOutline.i16XMax, g_psBlackKeys[ui32Key].sOutline.i16YMin + 1, g_psBlackKeys[ui32Key].sOutline.i16XMax, g_psBlackKeys[ui32Key].sOutline.i16YMax); GrLineDraw(pContext, g_psBlackKeys[ui32Key].sOutline.i16XMax - 1, g_psBlackKeys[ui32Key].sOutline.i16YMin + 2, g_psBlackKeys[ui32Key].sOutline.i16XMax - 1, g_psBlackKeys[ui32Key].sOutline.i16YMax - 1); GrLineDraw(pContext, g_psBlackKeys[ui32Key].sOutline.i16XMin + 1, g_psBlackKeys[ui32Key].sOutline.i16YMax, g_psBlackKeys[ui32Key].sOutline.i16XMax - 1, g_psBlackKeys[ui32Key].sOutline.i16YMax); GrLineDraw(pContext, g_psBlackKeys[ui32Key].sOutline.i16XMin + 2, g_psBlackKeys[ui32Key].sOutline.i16YMax - 1, g_psBlackKeys[ui32Key].sOutline.i16XMax - 2, g_psBlackKeys[ui32Key].sOutline.i16YMax - 1); // // Fill in the black key with the default color. // FillBlackKey(pContext, ui32Key, ClrBlackKey); }}
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:79,
示例17: main//*****************************************************************************//// The main code for the application. It sets up the peripherals, displays the// splash screens, and then manages the interaction between the game and the// screen saver.////*****************************************************************************intmain(void){ tRectangle sRect;#ifndef _TMS320C6X unsigned int index;#endif SetupIntc(); /* Configuring UART2 instance for serial communication. */ UARTStdioInit();#ifdef _TMS320C6X CacheEnableMAR((unsigned int)0xC0000000, (unsigned int)0x20000000); CacheEnable(L1PCFG_L1PMODE_32K | L1DCFG_L1DMODE_32K | L2CFG_L2MODE_256K);#else /* Sets up 'Level 1" page table entries. * The page table entry consists of the base address of the page * and the attributes for the page. The following operation is to * setup one-to-one mapping page table for DDR memeory range and set * the atributes for the same. The DDR memory range is from 0xC0000000 * to 0xDFFFFFFF. Thus the base of the page table ranges from 0xC00 to * 0xDFF. Cache(C bit) and Write Buffer(B bit) are enabled only for * those page table entries which maps to DDR RAM and internal RAM. * All the pages in the DDR range are provided with R/W permissions */ for(index = 0; index < (4*1024); index++) { if((index >= 0xC00 && index < 0xE00)|| (index == 0x800)) { pageTable[index] = (index << 20) | 0x00000C1E; } else { pageTable[index] = (index << 20) | 0x00000C12; } } /* Configures translation table base register * with pagetable base address. */ CP15TtbSet((unsigned int )pageTable); /* Enables MMU */ CP15MMUEnable(); /* Enable Instruction Cache */ CP15ICacheEnable(); /* Enable Data Cache */ CP15DCacheEnable();#endif SetUpLCD(); ConfigureFrameBuffer(); GrOffScreen16BPPInit(&g_sSHARP480x272x16Display0, (unsigned char *)g_pucBuffer0, LCD_WIDTH, LCD_HEIGHT); GrOffScreen16BPPInit(&g_sSHARP480x272x16Display1, (unsigned char *)g_pucBuffer1, LCD_WIDTH, LCD_HEIGHT); // Initialize a drawing context. GrContextInit(&sContext0, &g_sSHARP480x272x16Display0); GrContextInit(&sContext1, &g_sSHARP480x272x16Display1); /* enable End of frame interrupt */ RasterEndOfFrameIntEnable(SOC_LCDC_0_REGS); /* enable raster */ RasterEnable(SOC_LCDC_0_REGS); PeripheralsSetup(); I2C0IntRegister(4); AIC31Init(); ToneLoopInit(); /* Start playing the tone */ ToneLoopStart(); // TS init TouchInit(); GrContextForegroundSet(&sContext0, ClrBlack); GrContextForegroundSet(&sContext1, ClrBlack); sRect.sXMin = GAME_X - 1; sRect.sYMin = GAME_Y - 1; sRect.sXMax = GAME_X + GAME_W; sRect.sYMax = GAME_Y + GAME_H; GrRectFill(&sContext0, &sRect); GrRectFill(&sContext1, &sRect); GrImageDraw(&sContext0, g_pucTILogo128x96, GAME_X, GAME_Y); GrImageDraw(&sContext1, g_pucTILogo128x96, GAME_X, GAME_Y);//.........这里部分代码省略.........
开发者ID:ev3osek,项目名称:ev3osek,代码行数:101,
示例18: main//*****************************************************************************//// This example demonstrates how to send a string of data to the UART.////*****************************************************************************intmain(void){ tRectangle sRect; tContext sContext; // // 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 display driver. // CFAL96x64x16Init(); // // Initialize the graphics context. // GrContextInit(&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(&sContext) - 1; sRect.i16YMax = 9; GrContextForegroundSet(&sContext, ClrDarkBlue); GrRectFill(&sContext, &sRect); // // Change foreground for white text. // GrContextForegroundSet(&sContext, ClrWhite); // // Put the application name in the middle of the banner. // GrContextFontSet(&sContext, g_psFontFixed6x8); GrStringDrawCentered(&sContext, "uart-echo", -1, GrContextDpyWidthGet(&sContext) / 2, 4, 0); // // Initialize the display and write some instructions. // GrStringDrawCentered(&sContext, "Connect a", -1, GrContextDpyWidthGet(&sContext) / 2, 20, false); GrStringDrawCentered(&sContext, "terminal", -1, GrContextDpyWidthGet(&sContext) / 2, 30, false); GrStringDrawCentered(&sContext, "to UART0.", -1, GrContextDpyWidthGet(&sContext) / 2, 40, false); GrStringDrawCentered(&sContext, "115000,N,8,1", -1, GrContextDpyWidthGet(&sContext) / 2, 50, false); // // Enable the peripherals used by this example. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // // Enable processor interrupts. // ROM_IntMasterEnable(); // // Set GPIO A0 and A1 as UART pins. // ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Configure the UART for 115,200, 8-N-1 operation. // ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // // Enable the UART interrupt. // ROM_IntEnable(INT_UART0); ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); // // Prompt for text to be entered. ////.........这里部分代码省略.........
开发者ID:bli19,项目名称:unesp_mdt,代码行数:101,
示例19: OnDrawstatic void OnDraw(tContext *pContext){ char buf[20]; // clear screen GrContextForegroundSet(pContext, ClrBlack); GrContextBackgroundSet(pContext, ClrWhite); GrRectFill(pContext, &fullscreen_clip); // draw table title GrContextForegroundSet(pContext, ClrWhite); GrContextBackgroundSet(pContext, ClrBlack); const tRectangle rect = {0, 27, 255, 41}; GrRectFill(pContext, &rect); // draw the title bar GrContextFontSet(pContext, &g_sFontGothic18b); sprintf(buf, "%s %d", toMonthName(month, 1), year); GrStringDrawCentered(pContext, buf, -1, LCD_WIDTH / 2, 15, 0); GrContextForegroundSet(pContext, ClrBlack); GrContextBackgroundSet(pContext, ClrWhite); GrContextFontSet(pContext, &g_sFontGothic18); for(int i = 0; i < 7; i++) { GrStringDrawCentered( pContext, week_shortname[i], -1, i * 20 + 11, 35, 0); // draw line in title bar GrLineDrawV(pContext, i * 20, 28, 42); } GrContextFontSet(pContext, &g_sFontGothic18); GrContextForegroundSet(pContext, ClrWhite); GrContextBackgroundSet(pContext, ClrBlack); // get the start point of this month uint8_t weekday = rtc_getweekday(year, month, 1) - 1; // use 0 as index uint8_t maxday = rtc_getmaxday(year, month); uint8_t y = 50; for(int day = 1; day <= maxday; day++) { sprintf(buf, "%d", day); uint8_t today = now_year == year && now_month == month && now_day == day; if (today) { const tRectangle rect = {weekday * 20 + 1, y - 7, 20 + weekday * 20 - 1, y + 7}; GrRectFill(pContext, &rect); GrContextForegroundSet(pContext, ClrBlack); GrContextBackgroundSet(pContext, ClrWhite); } GrStringDrawCentered( pContext, buf, -1, weekday * 20 + 11, y, 0); if (today) { const tRectangle rect2 = {weekday * 20 + 16, y - 5, weekday * 20 + 17, y - 4}; GrRectFill(pContext, &rect2); GrContextForegroundSet(pContext, ClrWhite); GrContextBackgroundSet(pContext, ClrBlack); } if (weekday != 6) GrLineDrawV(pContext, (weekday + 1 ) * 20, 42, y + 7); weekday++; if (weekday == 7) { GrLineDrawH(pContext, 0, LCD_WIDTH, y + 8); weekday = 0; y += 20; } } GrLineDrawH(pContext, 0, weekday * 20, y + 8); // draw the buttons if (month == 1) sprintf(buf, "%s %d", toMonthName(12, 0), year - 1); else sprintf(buf, "%s %d", toMonthName(month - 1, 0), year); window_button(pContext, KEY_ENTER, buf); if (month == 12) sprintf(buf, "%s %d", toMonthName(1, 0), year + 1); else sprintf(buf, "%s %d", toMonthName(month + 1, 0), year); window_button(pContext, KEY_DOWN, buf);}
开发者ID:Echoskope,项目名称:KreyosFirmware,代码行数:88,
示例20: SliderPaint//*****************************************************************************////! Draws a slider.//!//! /param pWidget is a pointer to the slider widget to be drawn.//! /param pDirty is the subrectangle of the widget which is to be redrawn.//! This is expressed in screen coordinates.//!//! This function draws a slider on the display. This is called in response to//! a /b #WIDGET_MSG_PAINT message or when the slider position changes.//!//! /return None.////*****************************************************************************static voidSliderPaint(tWidget *pWidget, tRectangle *pDirty){ tRectangle sClipRect, sValueRect, sEmptyRect, sActiveClip; tSliderWidget *pSlider; tContext sCtx; unsigned lX, lY, bIntersect; short sPos; // // Convert the generic widget pointer into a slider widget pointer. // pSlider = (tSliderWidget *)pWidget; // // Initialize a drawing context. // GrContextInit(&sCtx, pWidget->pDisplay); // // Initialize the clipping region based on the update rectangle passed. // bIntersect = GrRectIntersectGet(pDirty, &(pSlider->sBase.sPosition), &sClipRect); GrContextClipRegionSet(&sCtx, &sClipRect); // // Draw the control outline if necessary. // if(pSlider->ulStyle & SL_STYLE_OUTLINE) { // // Outline the slider with the outline color. // GrContextForegroundSet(&sCtx, pSlider->ulOutlineColor); GrRectDraw(&sCtx, &(pWidget->sPosition)); // // Adjust the clipping rectangle to prevent the outline from being // corrupted later. // if(sClipRect.sXMin == pWidget->sPosition.sXMin) { sClipRect.sXMin++; } if(sClipRect.sYMin == pWidget->sPosition.sYMin) { sClipRect.sYMin++; } if(sClipRect.sXMax == pWidget->sPosition.sXMax) { sClipRect.sXMax--; } if(sClipRect.sYMax == pWidget->sPosition.sYMax) { sClipRect.sYMax--; } } // // Determine the position associated with the current slider value. // sPos = SliderValueToPosition(pSlider, pSlider->lValue); // // Remember this so that the dirty rectangle code in the click handler // draws the correct thing the first time it is called. // pSlider->sPos = sPos; // // Determine the rectangles for the active and empty portions of the // widget. // if(pSlider->ulStyle & SL_STYLE_VERTICAL) { // // Determine the rectangle corresponding to the bottom (value) portion // of the slider. // sValueRect.sXMin = pWidget->sPosition.sXMin; sValueRect.sXMax = pWidget->sPosition.sXMax; sValueRect.sYMin = sPos;//.........这里部分代码省略.........
开发者ID:Ziul,项目名称:OLED-Firmware,代码行数:101,
示例21: TSMainHandler//*****************************************************************************//// The main loop handler for touch screen events from the touch screen driver.////*****************************************************************************int32_tTSMainHandler(uint32_t ui32Message, int32_t i32X, int32_t i32Y){ tRectangle sRect; // // See which event is being sent from the touch screen driver. // switch(ui32Message) { // // The pen has just been placed down. // case WIDGET_MSG_PTR_DOWN: { // // Erase the drawing area. // GrContextForegroundSet(&g_sContext, ClrBlack); sRect.i16XMin = 0; sRect.i16YMin = 0; sRect.i16XMax = 319; sRect.i16YMax = 239; GrRectFill(&g_sContext, &sRect); // // Flush any cached drawing operations. // GrFlush(&g_sContext); // // Set the drawing color to the current pen color. // GrContextForegroundSet(&g_sContext, g_pui32Colors[g_ui32ColorIdx]); // // Save the current position. // g_i32X = i32X; g_i32Y = i32Y; // // This event has been handled. // break; } // // Then pen has moved. // case WIDGET_MSG_PTR_MOVE: { // // Draw a line from the previous position to the current position. // GrLineDraw(&g_sContext, g_i32X, g_i32Y, i32X, i32Y); // // Flush any cached drawing operations. // GrFlush(&g_sContext); // // Save the current position. // g_i32X = i32X; g_i32Y = i32Y; // // This event has been handled. // break; } // // The pen has just been picked up. // case WIDGET_MSG_PTR_UP: { // // Draw a line from the previous position to the current position. // GrLineDraw(&g_sContext, g_i32X, g_i32Y, i32X, i32Y); // // Flush any cached drawing operations. // GrFlush(&g_sContext); // // Increment to the next drawing color. // g_ui32ColorIdx++; if(g_ui32ColorIdx == (sizeof(g_pui32Colors) / sizeof(g_pui32Colors[0]))) { g_ui32ColorIdx = 0; } ////.........这里部分代码省略.........
开发者ID:peterliu2,项目名称:tivaWare,代码行数:101,
示例22: main//*****************************************************************************//// This example demonstrates how to send a string of data to the UART.////*****************************************************************************intmain(void){ tRectangle sRect; // // Set the clocking to run directly from the crystal. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // // Initialize the display driver. // Formike128x128x16Init(); // // Turn on the backlight. // Formike128x128x16BacklightOn(); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sFormike128x128x16); // // Fill the top 15 rows of the screen with blue to create the banner. // sRect.sXMin = 0; sRect.sYMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = 14; GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, &g_sFontFixed6x8); GrStringDrawCentered(&g_sContext, "uart_echo", -1, GrContextDpyWidthGet(&g_sContext) / 2, 7, 0); // // Initialize the CSTN display and write status. // GrStringDraw(&g_sContext, "Port: Uart 0", -1, 12, 24, 0); GrStringDraw(&g_sContext, "Baud: 115,200 bps", -1, 12, 32, 0); GrStringDraw(&g_sContext, "Data: 8 Bit", -1, 12, 40, 0); GrStringDraw(&g_sContext, "Parity: None", -1, 12, 48, 0); GrStringDraw(&g_sContext, "Stop: 1 Bit", -1, 12, 56, 0); // // Enable the peripherals used by this example. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Enable processor interrupts. // IntMasterEnable(); // // Set GPIO A0 and A1 as UART pins. // ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Configure the UART for 115,200, 8-N-1 operation. // ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // // Enable the UART interrupt. // ROM_IntEnable(INT_UART0); ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); // // Prompt for text to be entered. // UARTSend((unsigned char *)"Ingrese un Texto: ", 18); // // Loop forever echoing data through the UART. ////.........这里部分代码省略.........
开发者ID:fejerson108,项目名称:Stellarisware,代码行数:101,
示例23: main//*****************************************************************************//// Run the hibernate example. Use a loop to put the microcontroller into// hibernate mode, and to wake up based on time. Also allow the user to cause// it to hibernate and/or wake up based on button presses.////*****************************************************************************intmain(void){ uint32_t ui32Idx; uint32_t ui32Status = 0; uint32_t ui32HibernateCount = 0; 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_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Initialize the UART. // ConfigureUART(); // // Initialize the OLED display // 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 = 9; GrContextForegroundSet(&sContext, ClrDarkBlue); GrRectFill(&sContext, &sRect); // // Change foreground for white text. // GrContextForegroundSet(&sContext, ClrWhite); // // Put the application name in the middle of the banner. // GrContextFontSet(&sContext, g_psFontFixed6x8); GrStringDrawCentered(&sContext, "hibernate", -1, GrContextDpyWidthGet(&sContext) / 2, 4, 0); // // Initialize the buttons driver // ButtonsInit(); // // Set up systick to generate interrupts at 100 Hz. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Enable the Hibernation module. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE); // // Print wake cause message on display. // GrStringDrawCentered(&sContext, "Wake due to:", -1, GrContextDpyWidthGet(&sContext) / 2, Row(2) + 4, true); // // Check to see if Hibernation module is already active, which could mean // that the processor is waking from a hibernation. // if(HibernateIsActive()) { // // Read the status bits to see what caused the wake. // ui32Status = HibernateIntStatus(0);//.........这里部分代码省略.........
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:101,
示例24: ClockSetPaint//*****************************************************************************////! Paints the clock set widget on the display.//!//! /param psWidget is a pointer to the clock setting widget to be drawn.//!//! This function draws the date and time fields of the clock setting widget//! onto the display. One of the fields can be highlighted. This is//! called in response to a /b WIDGET_MSG_PAINT message.//!//! /return None.////*****************************************************************************static voidClockSetPaint(tWidget *psWidget){ tClockSetWidget *psClockWidget; tContext sContext; tRectangle sRect, sRectSel; struct tm *psTime; char pcBuf[8]; int32_t i32X, i32Y, i32Width, i32Height; uint32_t ui32Idx, ui32FontHeight, ui32FontWidth, ui32SelWidth; // // Check the arguments. // ASSERT(psWidget); ASSERT(psWidget->psDisplay); // // Convert the generic widget pointer into a clock set widget pointer. // psClockWidget = (tClockSetWidget *)psWidget; ASSERT(psClockWidget->psTime); // // Get pointer to the time structure // psTime = psClockWidget->psTime; // // Initialize a drawing context. // GrContextInit(&sContext, psWidget->psDisplay); // // Initialize the clipping region based on the extents of this widget. // GrContextClipRegionSet(&sContext, &(psWidget->sPosition)); // // Set the font for the context, and get font height and width - they // are used a lot later. // GrContextFontSet(&sContext, psClockWidget->psFont); ui32FontHeight = GrFontHeightGet(psClockWidget->psFont); ui32FontWidth = GrFontMaxWidthGet(psClockWidget->psFont); // // Fill the widget with the background color. // GrContextForegroundSet(&sContext, psClockWidget->ui32BackgroundColor); GrRectFill(&sContext, &sContext.sClipRegion); // // Draw a border around the widget // GrContextForegroundSet(&sContext, psClockWidget->ui32ForegroundColor); GrContextBackgroundSet(&sContext, psClockWidget->ui32BackgroundColor); GrRectDraw(&sContext, &sContext.sClipRegion); // // Compute a rectangle for the screen title. Put it at the top of // the widget display, and sized to be the height of the font, plus // a few pixels of space. // sRect.i16XMin = sContext.sClipRegion.i16XMin; sRect.i16XMax = sContext.sClipRegion.i16XMax; sRect.i16YMin = sContext.sClipRegion.i16YMin; sRect.i16YMax = ui32FontHeight * 2; GrRectDraw(&sContext, &sRect); // // Print a title for the widget // GrContextFontSet(&sContext, psClockWidget->psFont); GrStringDrawCentered(&sContext, "CLOCK SET", -1, (1 + sRect.i16XMax - sRect.i16XMin) / 2, (1 + sRect.i16YMax - sRect.i16YMin) / 2, 1); // // Reset the rectangle to cover the non-title area of the display // sRect.i16YMin = sRect.i16YMax + 1; sRect.i16YMax = sContext.sClipRegion.i16YMax; // // Compute the width and height of the area remaining for showing the // clock fields.//.........这里部分代码省略.........
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:101,
示例25: main//*****************************************************************************//// This is the main loop that runs the application.////*****************************************************************************intmain(void){ tRectangle sRect; // // Set the clocking to run from the PLL at 50MHz. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // 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 = (DISPLAY_BANNER_HEIGHT) - 1; GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); GrRectFill(&g_sContext, &sRect); // // Change foreground for white text. // GrContextForegroundSet(&g_sContext, DISPLAY_TEXT_FG); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, g_psFontFixed6x8); GrStringDrawCentered(&g_sContext, "usb-host-mouse", -1, GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); // // Display default information about the mouse // GrStringDrawCentered(&g_sContext, "Position:", -1, GrContextDpyWidthGet(&g_sContext) / 2, 16, 0); GrStringDrawCentered(&g_sContext, "-,-", -1, GrContextDpyWidthGet(&g_sContext) / 2, 26, 1); GrStringDrawCentered(&g_sContext, "Buttons:", -1, GrContextDpyWidthGet(&g_sContext) / 2, 36, 0); GrStringDrawCentered(&g_sContext, "---", -1, GrContextDpyWidthGet(&g_sContext) / 2, 46, 1); // // Fill the bottom rows of the screen with blue to create the status area. // sRect.i16XMin = 0; sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - DISPLAY_BANNER_HEIGHT - 1; sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT; GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Print a no device message a placeholder for the message printed // during an event. // GrStringDrawCentered(&g_sContext, "No Device", -1, GrContextDpyWidthGet(&g_sContext) / 2, sRect.i16YMin + 5, 0); // // Configure SysTick for a 100Hz interrupt. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND); ROM_SysTickEnable(); ROM_SysTickIntEnable(); // // Enable Clocking to the USB controller. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); // // Configure the required pins for USB operation.//.........这里部分代码省略.........
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,
示例26: OnPrimitivePaint//*****************************************************************************//// Handles paint requests for the primitives canvas widget.////*****************************************************************************voidOnPrimitivePaint(tWidget *pWidget, tContext *pContext){ uint32_t ulIdx; tRectangle sRect; // // Draw a vertical sweep of lines from red to green. // for(ulIdx = 0; ulIdx <= 8; ulIdx++) { GrContextForegroundSet(pContext, (((((10 - ulIdx) * 255) / 10) << ClrRedShift) | (((ulIdx * 255) / 10) << ClrGreenShift))); GrLineDraw(pContext, 115, 120, 5, 120 - (11 * ulIdx)); } // // Draw a horizontal sweep of lines from green to blue. // for(ulIdx = 1; ulIdx <= 10; ulIdx++) { GrContextForegroundSet(pContext, (((((10 - ulIdx) * 255) / 10) << ClrGreenShift) | (((ulIdx * 255) / 10) << ClrBlueShift))); GrLineDraw(pContext, 115, 120, 5 + (ulIdx * 11), 29); } // // Draw a filled circle with an overlapping circle. // GrContextForegroundSet(pContext, ClrBrown); GrCircleFill(pContext, 185, 69, 40); GrContextForegroundSet(pContext, ClrSkyBlue); GrCircleDraw(pContext, 205, 99, 30); // // Draw a filled rectangle with an overlapping rectangle. // GrContextForegroundSet(pContext, ClrSlateGray); sRect.i16XMin = 20; sRect.i16YMin = 100; sRect.i16XMax = 75; sRect.i16YMax = 160; GrRectFill(pContext, &sRect); GrContextForegroundSet(pContext, ClrSlateBlue); sRect.i16XMin += 40; sRect.i16YMin += 40; sRect.i16XMax += 30; sRect.i16YMax += 28; GrRectDraw(pContext, &sRect); // // Draw a piece of text in fonts of increasing size. // GrContextForegroundSet(pContext, ClrSilver); GrContextFontSet(pContext, &g_sFontCm14); GrStringDraw(pContext, "Strings", -1, 125, 110, 0); GrContextFontSet(pContext, &g_sFontCm18); GrStringDraw(pContext, "Strings", -1, 145, 124, 0); GrContextFontSet(pContext, &g_sFontCm22); GrStringDraw(pContext, "Strings", -1, 165, 142, 0); GrContextFontSet(pContext, &g_sFontCm24); GrStringDraw(pContext, "Strings", -1, 185, 162, 0); // // Draw an image. // GrImageDraw(pContext, g_pucLogo, 270, 80);}
开发者ID:xolalpay,项目名称:CPE403-TIVAC-LABS,代码行数:76,
示例27: main//*****************************************************************************//// This example decrypts blocks of plaintext using TDES in CBC mode. It// does the decryption first without uDMA and then with uDMA. The results// are checked after each operation.////*****************************************************************************intmain(void){ uint32_t pui32PlainText[16], ui32Errors, ui32Idx, ui32SysClock; tContext sContext; // // 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(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(ui32SysClock); // // Initialize the graphics context. // GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&sContext, "tdes-cbc-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++) { pui32PlainText[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 decryption demo./n"); GrStringDrawCentered(&sContext, "Starting demo...", -1, GrContextDpyWidthGet(&sContext) / 2, 140, false); // // 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; }//.........这里部分代码省略.........
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:101,
示例28: mainvoid main(void){ WDT_A_hold(WDT_A_BASE); // Stop WDT boardInit(); // Basic GPIO initialization clockInit(8000000); // Config clocks. MCLK=SMCLK=FLL=8MHz; ACLK=REFO=32kHz Sharp96x96_LCDInit(); // Set up the LCD GrContextInit(&g_sContext, &g_sharp96x96LCD); GrContextForegroundSet(&g_sContext, ClrBlack); GrContextBackgroundSet(&g_sContext, ClrWhite); GrContextFontSet(&g_sContext, &g_sFontFixed6x8); GrClearDisplay(&g_sContext); GrFlush(&g_sContext); while(1){ // Intro Screen GrClearDisplay(&g_sContext); GrStringDrawCentered(&g_sContext, "How to use", AUTO_STRING_LENGTH, 48, 15, TRANSPARENT_TEXT); GrStringDrawCentered(&g_sContext, "the MSP430", AUTO_STRING_LENGTH, 48, 35, TRANSPARENT_TEXT); GrStringDraw(&g_sContext, "Graphics Library", AUTO_STRING_LENGTH, 1, 51, TRANSPARENT_TEXT); GrStringDrawCentered(&g_sContext, "Primitives", AUTO_STRING_LENGTH, 48, 75, TRANSPARENT_TEXT); GrFlush(&g_sContext); Delay(); GrClearDisplay(&g_sContext); // Draw pixels and lines on the display GrStringDrawCentered(&g_sContext, "Draw Pixels", AUTO_STRING_LENGTH, 48, 5, TRANSPARENT_TEXT); GrStringDrawCentered(&g_sContext, "& Lines", AUTO_STRING_LENGTH, 48, 15, TRANSPARENT_TEXT); GrPixelDraw(&g_sContext, 30, 30); GrPixelDraw(&g_sContext, 30, 32); GrPixelDraw(&g_sContext, 32, 32); GrPixelDraw(&g_sContext, 32, 30); GrLineDraw(&g_sContext, 35, 35, 90, 90); GrLineDraw(&g_sContext, 5, 80, 80, 20); GrLineDraw(&g_sContext, 0, GrContextDpyHeightGet(&g_sContext) - 1, GrContextDpyWidthGet(&g_sContext) - 1, GrContextDpyHeightGet(&g_sContext) - 1); GrFlush(&g_sContext); Delay(); GrClearDisplay(&g_sContext); // Draw circles on the display GrStringDraw(&g_sContext, "Draw Circles", AUTO_STRING_LENGTH, 10, 5, TRANSPARENT_TEXT); GrCircleDraw(&g_sContext, 30, 70, 20); GrCircleFill(&g_sContext, 60, 50, 30); GrFlush(&g_sContext); Delay(); GrClearDisplay(&g_sContext); // Draw rectangles on the display GrStringDrawCentered(&g_sContext, "Draw Rectangles",//.........这里部分代码省略.........
开发者ID:GevenM,项目名称:msp430f5529_sharp_display,代码行数:101,
示例29: SlideMenuDraw//*****************************************************************************////! Draws the current menu into a drawing context, off-screen buffer.//!//! /param pMenuWidget points at the SlideMenuWidget being processed.//! /param pContext points to the context where all drawing should be done.//! /param lOffsetY is the Y offset for drawing the menu.//!//! This function renders a menu (set of menu items), into a drawing context.//! It assumes that the drawing context is an off-screen buffer, and that//! the entire buffer belongs to this widget. The vertical position of the//! menu can be adjusted by using the parameter lOffsetY. This value can be//! positive or negative and can cause the menu to be rendered above or below//! the normal position in the display.//!//! /return None.////*****************************************************************************voidSlideMenuDraw(tSlideMenuWidget *pMenuWidget, tContext *pContext, long lOffsetY){ tSlideMenu *pMenu; unsigned long ulIdx; tRectangle sRect; // // Check the arguments // ASSERT(pMenuWidget); ASSERT(pContext); // // Set the foreground color for the rectangle fill to match what we want // as the menu background. // GrContextForegroundSet(pContext, pMenuWidget->ulColorBackground); GrRectFill(pContext, &pContext->sClipRegion); // // Get the current menu that is being displayed // pMenu = pMenuWidget->pSlideMenu; // // Set the foreground to the color we want for the menu item boundaries // and text color, text font. // GrContextForegroundSet(pContext, pMenuWidget->ulColorForeground); GrContextFontSet(pContext, pMenuWidget->pFont); // // Set the rectangle bounds for the first menu item. // The starting Y value is calculated based on which menu item is currently // centered. Y coordinates are subtracted to find the Y start location // of the first menu item, which could even be off the display. // // Set the X coords of the menu item to the extents of the display // sRect.sXMin = 0; sRect.sXMax = pContext->sClipRegion.sXMax; // // Find the Y coordinate of the centered menu item // sRect.sYMin = (pContext->pDisplay->usHeight / 2) - (pMenuWidget->ulMenuItemHeight / 2); // // Adjust to find Y coordinate of first menu item // sRect.sYMin -= pMenu->ulCenterIndex * pMenuWidget->ulMenuItemHeight; // // Now adjust for the offset that was passed in by caller. This allows // for drawing menu items above or below the main display. // sRect.sYMin += lOffsetY; // // Find the ending Y coordinate of first menu item // sRect.sYMax = sRect.sYMin + pMenuWidget->ulMenuItemHeight - 1; // // Start the index at the first menu item. It is possible that this // menu item is off the display. // ulIdx = 0; // // Loop through all menu items, drawing on the display. Note that some // may not be on the screen, but they will be clipped. // while(ulIdx < pMenu->ulItems) { // // If this index is the one that is highlighted, then change the // background // if(ulIdx == pMenu->ulFocusIndex)//.........这里部分代码省略.........
开发者ID:hakkinen86,项目名称:Luminary-Micro-Library,代码行数:101,
注:本文中的GrContextForegroundSet函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GrCrash函数代码示例 C++ GrContextFontSet函数代码示例 |