当前位置: 首页>>代码示例>>C++>>正文


C++ GrRectFill函数代码示例

本文整理汇总了C++中GrRectFill函数的典型用法代码示例。如果您正苦于以下问题:C++ GrRectFill函数的具体用法?C++ GrRectFill怎么用?C++ GrRectFill使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GrRectFill函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DisplayStatus

//*****************************************************************************
//
// Shows the status string on the color STN display.
//
// \param psContext is a pointer to the graphics context representing the
// display.
// \param pcStatus is a pointer to the string to be shown.
//
//*****************************************************************************
void
DisplayStatus(tContext *psContext, char *pcStatus)
{
    tRectangle rectLine;
    long lY;

    //
    // Calculate the Y coordinate of the top left of the character cell
    // for our line of text.
    //
    lY = (GrContextDpyHeightGet(psContext) / 4) -
         (GrFontHeightGet(TEXT_FONT) / 2);

    //
    // Determine the bounding rectangle for this line of text.
    //
    rectLine.sXMin = 0;
    rectLine.sXMax = GrContextDpyWidthGet(psContext) - 1;
    rectLine.sYMin = lY;
    rectLine.sYMax = lY + GrFontHeightGet(TEXT_FONT) - 1;

    //
    // Clear the line with black.
    //
    GrContextForegroundSet(&g_sContext, ClrBlack);
    GrRectFill(psContext, &rectLine);

    //
    // Draw the new status string
    //
    DEBUG_PRINT("%s\n", pcStatus);
    GrContextForegroundSet(&g_sContext, ClrWhite);
    GrStringDrawCentered(psContext, pcStatus, -1,
                         GrContextDpyWidthGet(psContext) / 2,
                         GrContextDpyHeightGet(psContext) / 4 , false);
}
开发者ID:yangjunjiao,项目名称:Luminary-Micro-Library,代码行数:45,代码来源:usb_dev_bulk.c

示例2: vShowBootText

/**
 * Show the Text for the Bootscreen
 */
void vShowBootText(char* text)
{

	/* Header Rectangle */
	tRectangle sRect;

	if (g_sContext.pDisplay == 0)
	{
		GrContextInit(&g_sContext, DISPLAY_DRIVER);
	}

	//
	// Fill the top 24 rows of the screen with blue to create the banner.
	//
	sRect.sXMin = 0;
	sRect.sYMin = 0;
	sRect.sXMax = GrContextDpyWidthGet(&g_sContext);
	sRect.sYMax = GrContextDpyHeightGet(&g_sContext);

	GrContextForegroundSet(&g_sContext, DISPLAY_BOOT_SCREEN_BACKGROUND_COLOR);
	GrContextBackgroundSet(&g_sContext, DISPLAY_BOOT_SCREEN_BACKGROUND_COLOR);
	GrRectFill(&g_sContext, &sRect);

	//
	// Put a white box around the banner.
	//
	GrRectDraw(&g_sContext, &sRect);

	GrContextForegroundSet(&g_sContext, DISPLAY_BOOT_SCREEN_COLOR);
	//
	// Put the application name in the middle of the banner.
	//
	GrContextFontSet(&g_sContext, DISPLAY_BOOT_SCREEN_FONT);
	GrStringDrawCentered(&g_sContext, text, -1,
			GrContextDpyWidthGet(&g_sContext) / 2, GrContextDpyHeightGet(&g_sContext) / 2, 0);
}
开发者ID:hitubaldaniya,项目名称:lumweb,代码行数:39,代码来源:displayBasics.c

示例3: DisplayStatus

//*****************************************************************************
//
// Shows the status string on the display.
//
// \param psContext is a pointer to the graphics context representing the
// display.
// \param pcStatus is a pointer to the string to be shown.
//
//*****************************************************************************
void
DisplayStatus(tContext *psContext, char *pcStatus)
{
    tRectangle sRectLine;
    int32_t i32Y;

    //
    // Calculate the Y coordinate of the top left of the character cell
    // for our line of text.
    //
    i32Y = GrContextDpyHeightGet(psContext) - GrFontHeightGet(TEXT_FONT) - 10;

    //
    // Determine the bounding rectangle for this line of text. We add 4 pixels
    // to the height just to ensure that we clear a couple of pixels above and
    // below the line of text.
    //
    sRectLine.i16XMin = 0;
    sRectLine.i16XMax = GrContextDpyWidthGet(psContext) - 1;
    sRectLine.i16YMin = i32Y - GrFontHeightGet(TEXT_FONT);
    sRectLine.i16YMax = i32Y + GrFontHeightGet(TEXT_FONT) + 3;

    //
    // Clear the line with black.
    //
    GrContextForegroundSet(&g_sContext, ClrBlack);
    GrRectFill(psContext, &sRectLine);

    //
    // Draw the new status string
    //
    GrContextForegroundSet(&g_sContext, ClrWhite);
    GrStringDrawCentered(psContext, pcStatus, -1,
                         GrContextDpyWidthGet(psContext) / 2,
                         i32Y, false);
}
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:45,代码来源:usb_dev_gamepad.c

示例4: main

//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
    uint_fast32_t ui32TxCount;
    uint_fast32_t ui32RxCount;
    tRectangle sRect;
    char pcBuffer[16];

    //
    // Enable lazy stacking for interrupt handlers.  This allows floating-point
    // instructions to be used within interrupt handlers, but at the expense of
    // extra stack usage.
    //
    ROM_FPULazyStackingEnable();

    //
    // Set the clocking to run from the PLL at 50MHz
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);

#ifdef DEBUG
    //
    // Configure the UART for debug output.
    //
    ConfigureUART();
#endif

    //
    // Not configured initially.
    //
    g_bUSBConfigured = false;

    //
    // Initialize the display driver.
    //
    CFAL96x64x16Init();

    //
    // Initialize the graphics context.
    //
    GrContextInit(&g_sContext, &g_sCFAL96x64x16);

    //
    // Fill the top part of the screen with blue to create the banner.
    //
    sRect.i16XMin = 0;
    sRect.i16YMin = 0;
    sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;
    sRect.i16YMax = 9;
    GrContextForegroundSet(&g_sContext, ClrDarkBlue);
    GrRectFill(&g_sContext, &sRect);

    //
    // Change foreground for white text.
    //
    GrContextForegroundSet(&g_sContext, ClrWhite);

    //
    // Put the application name in the middle of the banner.
    //
    GrContextFontSet(&g_sContext, g_psFontFixed6x8);
    GrStringDrawCentered(&g_sContext, "usb-dev-bulk", -1,
                         GrContextDpyWidthGet(&g_sContext) / 2, 4, 0);

    //
    // Show the various static text elements on the color STN display.
    //
    GrStringDraw(&g_sContext, "Tx bytes:", -1, 0, 32, false);
    GrStringDraw(&g_sContext, "Rx bytes:", -1, 0, 42, false);

    //
    // Enable the GPIO peripheral used for USB, and configure the USB
    // pins.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);

    //
    // Enable the system tick.
    //
    ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
    ROM_SysTickIntEnable();
    ROM_SysTickEnable();

    //
    // Show the application name on the display and UART output.
    //
    DEBUG_PRINT("\nTiva C Series USB bulk device example\n");
    DEBUG_PRINT("---------------------------------\n\n");

    //
    // Tell the user what we are up to.
//.........这里部分代码省略.........
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,代码来源:usb_dev_bulk.c

示例5: 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 void
ContainerPaint(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:VENGEL,项目名称:StellarisWare,代码行数:101,代码来源:container.c

示例6: UpdateStatus

//*****************************************************************************
//
// This function updates the status area of the screen.  It uses the current
// state of the application to print the status bar.
//
//*****************************************************************************
void
UpdateStatus(void)
{
    tRectangle sRect;

    //
    // Fill the bottom rows of the screen with blue to create the status area.
    //
    sRect.sXMin = 0;
    sRect.sYMin = GrContextDpyHeightGet(&g_sContext) -
                  DISPLAY_BANNER_HEIGHT - 1;
    sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;
    sRect.sYMax = sRect.sYMin + 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);

    //
    // Put the application name in the middle of the banner.
    //
    GrContextFontSet(&g_sContext, g_pFontFixed6x8);

    //
    // Update the status on the screen.
    //
    if(g_eUSBState == STATE_NO_DEVICE)
    {
        //
        // Keyboard is currently disconnected.
        //
        GrStringDrawCentered(&g_sContext, "no device", -1, 
                             GrContextDpyWidthGet(&g_sContext) / 2, 
                             sRect.sYMin + 5, 0);
    }
    else if(g_eUSBState == STATE_UNKNOWN_DEVICE)
    {
        //
        // Unknown device is currently connected.
        //
        GrStringDrawCentered(&g_sContext, "unknown device", -1, 
                             GrContextDpyWidthGet(&g_sContext) / 2, 
                             sRect.sYMin + 5, 0);
    }
    else if(g_eUSBState == STATE_POWER_FAULT)
    {
        //
        // Something caused a power fault.
        //
        GrStringDrawCentered(&g_sContext, "power fault", -1, 
                             GrContextDpyWidthGet(&g_sContext) / 2, 
                             sRect.sYMin + 5, 0);
    }
    else if((g_eUSBState == STATE_KEYBOARD_CONNECTED) ||
            (g_eUSBState == STATE_KEYBOARD_UPDATE))
    {
        //
        // Keyboard is connected.
        //
        GrStringDrawCentered(&g_sContext, "connected", -1, 
                             GrContextDpyWidthGet(&g_sContext) / 2, 
                             sRect.sYMin + 5, 0);

        //
        // Update the CAPS Lock status.
        //
        if(g_ulModifiers & HID_KEYB_CAPS_LOCK)
        {
            GrStringDrawCentered(&g_sContext, "C", 
                                 GrContextDpyWidthGet(&g_sContext) / 2, 
                                 sRect.sXMax - 10,
                                 sRect.sYMin + 5, 0);
        }
    }
}
开发者ID:hakkinen86,项目名称:Luminary-Micro-Library,代码行数:86,代码来源:usb_host_keyboard.c

示例7: main

//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
    uint32_t ui32TxCount, ui32RxCount, ui32Fullness, ui32SysClock, ui32PLLRate;
    tRectangle sRect;
    char pcBuffer[16];
#ifdef USE_ULPI
    uint32_t ui32Setting;
#endif

    //
    // Set the system clock to run at 120MHz from the PLL.
    //
    ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                           SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                                           SYSCTL_CFG_VCO_480), 120000000);

    //
    // Configure the device pins.
    //
    PinoutSet();

#ifdef USE_ULPI
    //
    // Switch the USB ULPI Pins over.
    //
    USBULPIPinoutSet();

    //
    // Enable USB ULPI with high speed support.
    //
    ui32Setting = USBLIB_FEATURE_ULPI_HS;
    USBOTGFeatureSet(0, USBLIB_FEATURE_USBULPI, &ui32Setting);

    //
    // Setting the PLL frequency to zero tells the USB library to use the
    // external USB clock.
    //
    ui32PLLRate = 0;
#else
    //
    // Save the PLL rate used by this application.
    //
    ui32PLLRate = 480000000;
#endif

    //
    // Enable the system tick.
    //
    ROM_SysTickPeriodSet(ui32SysClock / TICKS_PER_SECOND);
    ROM_SysTickIntEnable();
    ROM_SysTickEnable();

    //
    // Not configured initially.
    //
    g_ui32Flags = 0;

    //
    // Initialize the display driver.
    //
    Kentec320x240x16_SSD2119Init(ui32SysClock);

    //
    // Initialize the graphics context.
    //
    GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119);

    //
    // Draw the application frame.
    //
    FrameDraw(&g_sContext, "usb-dev-serial");

    //
    // Fill the top 15 rows of the screen with blue to create the banner.
    //
    sRect.i16XMin = 0;
    sRect.i16YMin = 0;
    sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;
    sRect.i16YMax = 23;
    GrContextForegroundSet(&g_sContext, ClrDarkBlue);
    GrRectFill(&g_sContext, &sRect);

    //
    // Put a white box around the banner.
    //
    GrContextForegroundSet(&g_sContext, ClrWhite);
    GrRectDraw(&g_sContext, &sRect);

    //
    // Show the various static text elements on the color STN display.
    //
    GrContextFontSet(&g_sContext, TEXT_FONT);
    GrStringDraw(&g_sContext, "Tx bytes:", -1, 8, 80, false);
    GrStringDraw(&g_sContext, "Tx buffer:", -1, 8, 105, false);
//.........这里部分代码省略.........
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,代码来源:usb_dev_serial.c

示例8: OnPrimitivePaint

//*****************************************************************************
//
// Handles paint requests for the primitives canvas widget.
//
//*****************************************************************************
void
OnPrimitivePaint(tWidget *pWidget, tContext *pContext)
{
    unsigned int 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+X_OFFSET, 120+Y_OFFSET, 5+X_OFFSET, 120+Y_OFFSET - (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+X_OFFSET, 120+Y_OFFSET, 5 + (ulIdx * 11)+X_OFFSET, 29+Y_OFFSET);
    }

    //
    // Draw a filled circle with an overlapping circle.
    //
    GrContextForegroundSet(pContext, ClrBrown);
    GrCircleFill(pContext, 185+X_OFFSET, 69+Y_OFFSET, 40);
    GrContextForegroundSet(pContext, ClrSkyBlue);
    GrCircleDraw(pContext, 205+X_OFFSET, 99+Y_OFFSET, 30);

    //
    // Draw a filled rectangle with an overlapping rectangle.
    //
    GrContextForegroundSet(pContext, ClrSlateGray);
    sRect.sXMin = 20+X_OFFSET;
    sRect.sYMin = 100+Y_OFFSET;
    sRect.sXMax = 75+X_OFFSET;
    sRect.sYMax = 160+Y_OFFSET;
    GrRectFill(pContext, &sRect);
    GrContextForegroundSet(pContext, ClrSlateBlue);
    sRect.sXMin += 40;
    sRect.sYMin += 40;
    sRect.sXMax += 30;
    sRect.sYMax += 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+X_OFFSET, 110+Y_OFFSET, 0);
    GrContextFontSet(pContext, &g_sFontCm18);
    GrStringDraw(pContext, "Strings", -1, 145+X_OFFSET, 124+Y_OFFSET, 0);
    GrContextFontSet(pContext, &g_sFontCm22);
    GrStringDraw(pContext, "Strings", -1, 165+X_OFFSET, 142+Y_OFFSET, 0);
    GrContextFontSet(pContext, &g_sFontCm24);
    GrStringDraw(pContext, "Strings", -1, 185+X_OFFSET, 162+Y_OFFSET, 0);

    //
    // Draw an image.
    //
    GrImageDraw(pContext, g_TILogo, 240+X_OFFSET, 60+Y_OFFSET);
}
开发者ID:ev3osek,项目名称:ev3osek,代码行数:76,代码来源:grlib_demo.c

示例9: main

//*****************************************************************************
//
// Print "Hello World!" to the display.
//
//*****************************************************************************
int
main(void)
{
    tContext sContext;
    tRectangle sRect;

    //
    // Enable lazy stacking for interrupt handlers.  This allows floating-point
    // instructions to be used within interrupt handlers, but at the expense of
    // extra stack usage.
    //
    ROM_FPULazyStackingEnable();

    //
    // Set the clocking to run directly from the crystal.
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |
                       SYSCTL_OSC_MAIN);

    //
    // Initialize the UART.
    //
    ConfigureUART();

    UARTprintf("Hello, world!\n");

    //
    // Initialize the display driver.
    //
    CFAL96x64x16Init();

    //
    // Initialize the graphics context.
    //
    GrContextInit(&sContext, &g_sCFAL96x64x16);

    //
    // Fill the top 24 rows of the screen with blue to create the banner.
    //
    sRect.i16XMin = 0;
    sRect.i16YMin = 0;
    sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1;
    sRect.i16YMax = 23;
    GrContextForegroundSet(&sContext, ClrDarkBlue);
    GrRectFill(&sContext, &sRect);

    //
    // Put a white box around the banner.
    //
    GrContextForegroundSet(&sContext, ClrWhite);
    GrRectDraw(&sContext, &sRect);

    //
    // Put the application name in the middle of the banner.
    //
    GrContextFontSet(&sContext, g_psFontCm12);
    GrStringDrawCentered(&sContext, "hello", -1,
                         GrContextDpyWidthGet(&sContext) / 2, 10, 0);

    //
    // Say hello using the Computer Modern 40 point font.
    //
    GrContextFontSet(&sContext, g_psFontCm12/*g_psFontFixed6x8*/);
    GrStringDrawCentered(&sContext, "Hello World!", -1,
                         GrContextDpyWidthGet(&sContext) / 2,
                         ((GrContextDpyHeightGet(&sContext) - 24) / 2) + 24,
                         0);

    //
    // Flush any cached drawing operations.
    //
    GrFlush(&sContext);

    //
    // We are finished. Hang around doing nothing.
    //
    while(1) {
    }
}
开发者ID:peterliu2,项目名称:tivaWare,代码行数:84,代码来源:hello.c

示例10: sportswatch_process

uint8_t sportswatch_process(uint8_t event, uint16_t lparam, void* rparam)
{
  UNUSED_VAR(lparam);
  switch(event)
  {
  case EVENT_WINDOW_CREATED:
    {
      if (rparam == (void*)0)
      {
          //running
          sports_type = SPORTS_DATA_FLAG_RUN;
          set_mode(DATA_MODE_RUNNING);
        //ant_init(MODE_HRM);
      }
      else
      {
          //cycling
          sports_type = SPORTS_DATA_FLAG_BIKE;
          set_mode(DATA_MODE_BIKING);
        //ant_init(MODE_CBSC);
      }
      rtc_enablechange(SECOND_CHANGE);

      cleanUpSportsWatchData();

      ui_config* config = window_readconfig();
      sportnum = config->sports_grid + 4;

      add_watch_status(WS_SPORTS);

      ble_start_sync(2, get_mode());
      return 0x80; // disable status
    }
  case EVENT_SPORT_DATA:
    {
      //printf("got a sport data \n");
      updateData(lparam, (uint32_t)rparam);
      break;
    }
  case EVENT_TIME_CHANGED:
    {
      workout_time++;
      updateData(SPORTS_TIME, workout_time);

      if (upload_data_interval > 0 &&
          workout_time % upload_data_interval == 0)
      {
        ui_config* config = window_readconfig();
        sportnum = config->sports_grid + 4;

        //STLV over RFCOMM
        send_sports_data(0, 
          sports_type | SPORTS_DATA_FLAG_START, 
          config->sports_grid_data, grid_data, sportnum);

        //BLE
        ble_send_sports_data(grid_data, 5);

      }

      if (workout_time % save_data_interval == 0 &&
       (get_mode() & DATA_MODE_PAUSED) != 0)
      {
        saveSportsData();
      }

      break;
    }
  case EVENT_WINDOW_PAINT:
    {
      tContext *pContext = (tContext*)rparam;
      GrContextForegroundSet(pContext, ClrBlack);
      GrRectFill(pContext, &fullscreen_clip);
      GrContextForegroundSet(pContext, ClrWhite);
      onDraw(pContext);
      break;
    }
  case EVENT_WINDOW_CLOSING:
    {
      rtc_enablechange(0);
#if PRODUCT_W001
      ant_shutdown();
#endif
      
      uint8_t dummy_stlv_meta = 0;
      uint32_t dummy_stlv_data = 0;
      send_sports_data(0, sports_type | SPORTS_DATA_FLAG_STOP, &dummy_stlv_meta, &dummy_stlv_data, 1);

      saveSportsData();
      ble_stop_sync();
      set_mode(DATA_MODE_NORMAL);
      del_watch_status(WS_SPORTS);
      break;
    }
  default:
    return 0;
  }

  return 1;
}
开发者ID:Echoskope,项目名称:KreyosFirmware,代码行数:100,代码来源:sportswatch.c

示例11: main

//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
int
main(void)
{
    tRectangle sRect;
    uint_fast32_t ui32Retcode;

    //
    // 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);

    //
    // Configure SysTick for a 100Hz interrupt.  The FatFs driver wants a 10 ms
    // tick.
    //
    ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100);
    ROM_SysTickEnable();
    ROM_SysTickIntEnable();

    //
    // Configure and enable uDMA
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    SysCtlDelay(10);
    ROM_uDMAControlBaseSet(&sDMAControlTable[0]);
    ROM_uDMAEnable();

    //
    // Initialize the display driver.
    //
    CFAL96x64x16Init();

    //
    // Initialize the graphics context.
    //
    GrContextInit(&g_sContext, &g_sCFAL96x64x16);

    //
    // Fill the top 15 rows 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, 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_psFontFixed6x8);
    GrStringDrawCentered(&g_sContext, "usb-dev-msc", -1,
                         GrContextDpyWidthGet(&g_sContext) / 2, 5, 0);

    //
    // Initialize the idle timeout and reset all flags.
    //
    g_ui32IdleTimeout = 0;
    g_ui32Flags = 0;

    //
    // Initialize the state to idle.
    //
    g_eMSCState = MSC_DEV_DISCONNECTED;

    //
    // Draw the status bar and set it to idle.
    //
    UpdateStatus("Disconnected", 1);

    //
    // Enable the USB controller.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);

    //
    // Set the USB pins to be controlled by the USB controller.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN);
    ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Set the USB stack mode to Device mode with VBUS monitoring.
//.........这里部分代码省略.........
开发者ID:peterliu2,项目名称:tivaWare,代码行数:101,代码来源:usb_dev_msc.c

示例12: UpdateStatus

//*****************************************************************************
//
// This function updates the status area of the screen.  It uses the current
// state of the application to print the status bar.
//
//*****************************************************************************
void
UpdateStatus(char *pcString, bool bClrBackground)
{
    tRectangle sRect;

    //
    //
    //
    GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG);

    if(bClrBackground) {
        //
        // 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;
        sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;
        sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT - 1;

        //
        // Draw the background of the banner.
        //
        GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG);
        GrRectFill(&g_sContext, &sRect);

        //
        // Put a white box around the banner.
        //
        GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG);
        GrRectDraw(&g_sContext, &sRect);
    } else {
        //
        // Fill the bottom rows of the screen with blue to create the status area.
        //
        sRect.i16XMin = 1;
        sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) -
                        DISPLAY_BANNER_HEIGHT + 1;
        sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 2;
        sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT - 3;

        //
        // Draw the background of the banner.
        //
        GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG);
        GrRectFill(&g_sContext, &sRect);

        //
        // White text in the banner.
        //
        GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG);
    }

    //
    // Write the current state to the left of the status area.
    //
    GrContextFontSet(&g_sContext, g_psFontFixed6x8);

    //
    // Update the status on the screen.
    //
    if(pcString != 0) {
        GrStringDrawCentered(&g_sContext, pcString,
                             -1, GrContextDpyWidthGet(&g_sContext) / 2,
                             58, 1);
    }
}
开发者ID:peterliu2,项目名称:tivaWare,代码行数:73,代码来源:usb_dev_msc.c

示例13: main


//.........这里部分代码省略.........
    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_long();
    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_long();
    GrClearDisplay(&g_sContext);

    // Draw rectangles on the display
    GrStringDrawCentered(&g_sContext, 
                         "Draw Rectangles", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         5, 
                         TRANSPARENT_TEXT);
    GrRectDraw(&g_sContext, &myRectangle1);
    GrRectFill(&g_sContext, &myRectangle2);
    GrFlush(&g_sContext);
    Delay_long();
    GrClearDisplay(&g_sContext);

    // Combining Primitive screen
    GrStringDrawCentered(&g_sContext, 
                         "Combining", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         15, 
                         TRANSPARENT_TEXT);
    GrStringDrawCentered(&g_sContext, 
                         "Primitives to", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         35, 
                         TRANSPARENT_TEXT);
    GrStringDrawCentered(&g_sContext, 
                         "create menus", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         51, 
                         TRANSPARENT_TEXT);
    GrStringDrawCentered(&g_sContext, 
                         "and animations", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         75, 
                         TRANSPARENT_TEXT);
    GrFlush(&g_sContext);
    Delay_long();
    GrClearDisplay(&g_sContext);
开发者ID:tnapiork,项目名称:all,代码行数:67,代码来源:main.c

示例14: main

//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
    unsigned int ulTxCount;
    unsigned int ulRxCount;
	tRectangle sRect;
	char pcBuffer[16];
	unsigned int i;
	unsigned char *src, *dest;
	
    MMUConfigAndEnable();	
	
	//
	// USB module clock enable
	//
	USB0ModuleClkConfig();

	//
	//USB interrupt enable
	//	
	USBInterruptEnable();

	//
	//LCD back light enable
	//
	LCDBackLightEnable();

	// UPD Pin setup
	//
	//
	UPDNPinControl();

	//
	//Delay timer setup
	//
	DelayTimerSetup();

	//
	//Configures raster to display image 
	//
	SetUpLCD();

	
    RasterDMAFBConfig(SOC_LCDC_0_REGS, 
					  (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
					  (unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 -
					  PALETTE_OFFSET, FRAME_BUFFER_0);

	RasterDMAFBConfig(SOC_LCDC_0_REGS, 
					  (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
					  (unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 - 
					  PALETTE_OFFSET, FRAME_BUFFER_1);

	src = (unsigned char *) palette_32b;
	dest = (unsigned char *) (g_pucBuffer+PALETTE_OFFSET);

	// Copy palette info into buffer
	for( i = PALETTE_OFFSET; i < (PALETTE_SIZE+PALETTE_OFFSET); i++)
	{
		*dest++ = *src++;
	}
		
	GrOffScreen24BPPInit(&g_s35_800x480x24Display, g_pucBuffer, LCD_WIDTH, LCD_HEIGHT);
	
	// Initialize a drawing context.
	GrContextInit(&g_sContext, &g_s35_800x480x24Display);

	/* enable End of frame interrupt */
	RasterEndOfFrameIntEnable(SOC_LCDC_0_REGS);

	/* enable raster */
	RasterEnable(SOC_LCDC_0_REGS);
	
	 //
    // 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 = 23;
    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-bulk", -1,
                         GrContextDpyWidthGet(&g_sContext) / 2, 10, 0);
//.........这里部分代码省略.........
开发者ID:OS-Project,项目名称:Divers,代码行数:101,代码来源:usb_dev_bulk.c

示例15: SliderPaint


//.........这里部分代码省略.........
    //
    lX = (pWidget->sPosition.sXMin +
          ((pWidget->sPosition.sXMax - pWidget->sPosition.sXMin + 1) / 2));
    lY = (pWidget->sPosition.sYMin +
          ((pWidget->sPosition.sYMax - pWidget->sPosition.sYMin + 1) / 2));

    //
    // Get the required clipping rectangle for the active/value part of
    // the slider.
    //
    bIntersect = GrRectIntersectGet(&sClipRect, &sValueRect, &sActiveClip);

    //
    // Does any part of the value rectangle intersect with the region we are
    // supposed to be redrawing?
    //
    if(bIntersect)
    {
        //
        // Yes - we have something to draw.
        //

        //
        // Set the new clipping rectangle.
        //
        GrContextClipRegionSet(&sCtx, &sActiveClip);

        //
        // Do we need to fill the active area with a color?
        //
        if(pSlider->ulStyle & SL_STYLE_FILL)
        {
            GrContextForegroundSet(&sCtx, pSlider->ulFillColor);
            GrRectFill(&sCtx, &sValueRect);
        }

        //
        // Do we need to draw an image in the active area?
        //
        if(pSlider->ulStyle & SL_STYLE_IMG)
        {
            GrContextForegroundSet(&sCtx, pSlider->ulTextColor);
            GrContextBackgroundSet(&sCtx, pSlider->ulFillColor);
            GrImageDraw(&sCtx, pSlider->pucImage,
                        lX - (GrImageWidthGet(pSlider->pucImage) / 2),
                        lY - (GrImageHeightGet(pSlider->pucImage) / 2));
        }

        //
        // Do we need to render a text string over the top of the active area?
        //
        if(pSlider->ulStyle & SL_STYLE_TEXT)
        {
            GrContextFontSet(&sCtx, pSlider->pFont);
            GrContextForegroundSet(&sCtx, pSlider->ulTextColor);
            GrContextBackgroundSet(&sCtx, pSlider->ulFillColor);
            GrStringDrawCentered(&sCtx, pSlider->pcText, -1, lX, lY,
                                 pSlider->ulStyle & SL_STYLE_TEXT_OPAQUE);
        }
    }

    //
    // Now get the required clipping rectangle for the background portion of
    // the slider.
    //
    bIntersect = GrRectIntersectGet(&sClipRect, &sEmptyRect, &sActiveClip);
开发者ID:saintent,项目名称:LM4F120,代码行数:67,代码来源:slider.c


注:本文中的GrRectFill函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。