本文整理汇总了C++中GrContextDpyHeightGet函数的典型用法代码示例。如果您正苦于以下问题:C++ GrContextDpyHeightGet函数的具体用法?C++ GrContextDpyHeightGet怎么用?C++ GrContextDpyHeightGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GrContextDpyHeightGet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayStatus
/******************************************************************************
* *
* \brief 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. *
* *
* \return none. *
* *
******************************************************************************/
void DisplayStatus(tContext *psContext, char *pcStatus)
{
tRectangle rectLine;
int lY;
/* Calculate the Y coordinate of the top left of the character cell
for our line of text.
*/
lY = (GrContextDpyHeightGet(psContext) / 8) -
(GrFontHeightGet(TEXT_FONT) / 2);
/* 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.
*/
rectLine.sXMin = 0;
rectLine.sXMax = GrContextDpyWidthGet(psContext) - 1;
rectLine.sYMin = lY;
rectLine.sYMax = lY + GrFontHeightGet(TEXT_FONT) + 3;
/* Clear the line with black. */
GrContextForegroundSet(&g_sContext, ClrBlack);
GrRectFill(psContext, &rectLine);
/* Draw the new status string */
GrContextForegroundSet(&g_sContext, ClrWhite);
GrStringDrawCentered(psContext, pcStatus, -1,
GrContextDpyWidthGet(psContext) / 2,
GrContextDpyHeightGet(psContext) / 8 , false);
}
示例2: WatchdogTouchCallback
//*****************************************************************************
//
// The touch screen driver calls this function to report all state changes.
//
//*****************************************************************************
static long
WatchdogTouchCallback(unsigned long ulMessage, long lX, long lY)
{
//
// If the screen is tapped, we will receive a PTR_DOWN then a PTR_UP
// message. We pick one (pretty much at random) to use as the trigger to
// stop feeding the watchdog.
//
if(ulMessage == WIDGET_MSG_PTR_UP)
{
//
// Let the user know that the tap has been registered and that the
// watchdog is being starved.
//
GrContextFontSet(&g_sContext, g_pFontCmss20);
GrStringDrawCentered(&g_sContext, "Watchdog is not being fed!", -1,
GrContextDpyWidthGet(&g_sContext) / 2 ,
(GrContextDpyHeightGet(&g_sContext) / 2), 1);
GrContextFontSet(&g_sContext, g_pFontCmss14);
GrStringDrawCentered(&g_sContext,
" System will reset shortly. ",
-1, GrContextDpyWidthGet(&g_sContext) / 2 ,
(GrContextDpyHeightGet(&g_sContext) / 2) + 20, 1);
//
// Set the flag that tells the interrupt handler not to clear the
// watchdog interrupt.
//
g_bFeedWatchdog = false;
}
return(0);
}
示例3: WatchdogTouchCallback
//*****************************************************************************
//
// The touch screen driver calls this function to report all state changes.
//
//*****************************************************************************
static int32_t
WatchdogTouchCallback(uint32_t ui32Message, int32_t i32X, int32_t i32Y)
{
//
// If the screen is tapped, we will receive a PTR_DOWN then a PTR_UP
// message. Use PTR_UP as the trigger to stop feeding the watchdog.
//
if(ui32Message == WIDGET_MSG_PTR_UP)
{
//
// See if the left or right side of the screen was touched.
//
if(i32X <= (GrContextDpyWidthGet(&g_sContext) / 2))
{
//
// Let the user know that the tap has been registered and that the
// watchdog0 is being starved.
//
GrContextFontSet(&g_sContext, g_psFontCmss20);
GrContextForegroundSet(&g_sContext, ClrRed);
GrStringDrawCentered(&g_sContext,
"Watchdog 0 starved, reset shortly", -1,
GrContextDpyWidthGet(&g_sContext) / 2 ,
(GrContextDpyHeightGet(&g_sContext) / 2) + 40,
1);
GrContextForegroundSet(&g_sContext, ClrWhite);
//
// Set the flag that tells the interrupt handler not to clear the
// watchdog0 interrupt.
//
g_bFeedWatchdog0 = false;
}
else
{
//
// Let the user know that the tap has been registered and that the
// watchdog1 is being starved.
//
GrContextFontSet(&g_sContext, g_psFontCmss20);
GrContextForegroundSet(&g_sContext, ClrRed);
GrStringDrawCentered(&g_sContext,
"Watchdog 1 starved, reset shortly", -1,
GrContextDpyWidthGet(&g_sContext) / 2 ,
(GrContextDpyHeightGet(&g_sContext) / 2) + 60,
1);
GrContextForegroundSet(&g_sContext, ClrWhite);
//
// Set the flag that tells the interrupt handler not to clear the
// watchdog1 interrupt.
//
g_bFeedWatchdog1 = false;
}
}
return(0);
}
示例4: 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.
//
// This implementation assumes we are using a 6 pixel wide font, giving us
// space for 16 characters across the display.
//
//*****************************************************************************
void
DisplayStatus(tContext *psContext, char *pcStatus)
{
tRectangle sRectLine;
//
// Determine the bounding rectangle for this line of text.
//
sRectLine.i16XMin = 0;
sRectLine.i16XMax = GrContextDpyWidthGet(psContext) - 1;
sRectLine.i16YMin = GrContextDpyHeightGet(psContext) - (TEXT_HEIGHT + 2);
sRectLine.i16YMax = sRectLine.i16YMin + GrFontHeightGet(TEXT_FONT) + 1;
//
// 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,
sRectLine.i16YMin + (TEXT_HEIGHT / 2), false);
}
示例5: vApplicationStackOverflowHook
//*****************************************************************************
//
// This hook is called by FreeRTOS when an stack overflow error is detected.
//
//*****************************************************************************
void
vApplicationStackOverflowHook(xTaskHandle *pxTask, signed char *pcTaskName)
{
tContext sContext;
//
// A fatal FreeRTOS error was detected, so display an error message.
//
GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
GrContextForegroundSet(&sContext, ClrRed);
GrContextBackgroundSet(&sContext, ClrBlack);
GrContextFontSet(&sContext, g_psFontCm20);
GrStringDrawCentered(&sContext, "Fatal FreeRTOS error!", -1,
GrContextDpyWidthGet(&sContext) / 2,
(((GrContextDpyHeightGet(&sContext) - 24) / 2) +
24), 1);
//
// This function can not return, so loop forever. Interrupts are disabled
// on entry to this function, so no processor interrupts will interrupt
// this loop.
//
while(1)
{
}
}
示例6: SafeRTOSErrorHook
//*****************************************************************************
//
// This hook is called by SafeRTOS when an error is detected.
//
//*****************************************************************************
static void
SafeRTOSErrorHook(xTaskHandle xHandleOfTaskWithError,
signed portCHAR *pcNameOfTaskWithError,
portBASE_TYPE xErrorCode)
{
tContext sContext;
//
// A fatal SafeRTOS error was detected, so display an error message.
//
GrContextInit(&sContext, &g_sKitronix320x240x16_SSD2119);
GrContextForegroundSet(&sContext, ClrRed);
GrContextBackgroundSet(&sContext, ClrBlack);
GrContextFontSet(&sContext, g_pFontCm20);
GrStringDrawCentered(&sContext, "Fatal SafeRTOS error!", -1,
GrContextDpyWidthGet(&sContext) / 2,
(((GrContextDpyHeightGet(&sContext) - 24) / 2) +
24), 1);
//
// This function can not return, so loop forever. Interrupts are disabled
// on entry to this function, so no processor interrupts will interrupt
// this loop.
//
while(1)
{
}
}
示例7: Timer1IntHandler
void Timer1IntHandler(void)
{
//debugled(10);
ROM_TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
//debugled(3);
int angle=0;
if(max2>0 && max1>0 && abs(maxi1-maxi2)<PULSE_SAMPLE)
{
//float dt=abs(maxi1-maxi2)/SAMPLING_FREQUENCY;
//angle=asin(dt*lambda/distance)*180/3.1412;
angle=abs(maxi1-maxi2);
}
//debugled(3);
acount++;
//rcount=0;
//ROM_IntMasterDisable();
snprintf(text,sizeof(text),"%3ld,%3ld",rcount,g_ulADCCount);
GrContextForegroundSet(&sDisplayContext, ClrDarkBlue);
GrRectFill(&sDisplayContext, &sRect1);
GrContextForegroundSet(&sDisplayContext, ClrWhite);
//GrRectDraw(&sDisplayContext, &sRect1);
GrContextFontSet(&sDisplayContext, g_pFontCm12);
GrStringDrawCentered(&sDisplayContext,text, -1,
GrContextDpyWidthGet(&sDisplayContext) / 2, 10, 0);
GrContextForegroundSet(&sDisplayContext, ClrDarkBlue);
GrRectFill(&sDisplayContext, &sRect2);
GrContextForegroundSet(&sDisplayContext, ClrWhite);
sprintf(text,"%4d,%4d",buffer_increment,rem);
GrContextFontSet(&sDisplayContext, g_pFontCm12/*g_pFontFixed6x8*/);
GrStringDrawCentered(&sDisplayContext, text, -1,
GrContextDpyWidthGet(&sDisplayContext) / 2,
((GrContextDpyHeightGet(&sDisplayContext) - 24) / 2) + 24,
0);
// GrFlush(&sDisplayContext);
max1=0;
max2=0;
res=0;
res1=0;
maxi1=0;
maxi2=0;
buffer_index=0;
for(i=0;i<buffer_size;i++)
{
buffer[0][i]=0;
buffer[1][i]=0;
}
i=0;
j=0;
ind2=buffer_index-buffer_increment+1;
}
示例8: HostMain
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
void
HostMain(void)
{
switch(iUSBState)
{
//
// This state is entered when the mouse is first detected.
//
case eStateMouseInit:
{
//
// Initialize the newly connected mouse.
//
USBHMouseInit(g_psMouseInstance);
//
// Proceed to the mouse connected state.
//
iUSBState = eStateMouseConnected;
//
// Update the status on the screen.
//
UpdateStatus(0, 0, true);
//
// Update the cursor on the screen.
//
UpdateCursor(GrContextDpyWidthGet(&g_sContext) / 2,
GrContextDpyHeightGet(&g_sContext)/ 2);
break;
}
case eStateMouseConnected:
{
//
// Nothing is currently done in the main loop when the mouse
// is connected.
//
break;
}
case eStateNoDevice:
{
//
// The mouse is not connected so nothing needs to be done here.
//
break;
}
default:
{
break;
}
}
//
// Periodically call the main loop for the Host controller driver.
//
USBHCDMain();
}
示例9: UIInit
//*****************************************************************************
//
// Initialize the application interface.
//
//*****************************************************************************
void
UIInit(uint32_t ui32SysClock)
{
//
// 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-host-keyboard");
//
// Set the font for the application.
//
GrContextFontSet(&g_sContext, g_psFontFixed6x8);
//
// Calculate the number of characters that will fit on a line.
// Make sure to leave a small border for the text box.
//
g_ui32CharsPerLine = (GrContextDpyWidthGet(&g_sContext) - 16) /
GrFontMaxWidthGet(g_psFontFixed6x8);
//
// Calculate the number of lines per usable text screen. This requires
// taking off space for the top and bottom banners and adding a small bit
// for a border.
//
g_ui32LinesPerScreen = (GrContextDpyHeightGet(&g_sContext) -
(2*(DISPLAY_BANNER_HEIGHT + 1)) -
BUTTON_HEIGHT) / GrFontHeightGet(g_psFontFixed6x8);
//
// Set up the text scrolling variables.
//
g_ui32CurrentLine = 0;
g_ui32EntryLine = 0;
//
// Draw the initial prompt on the screen.
//
DrawPrompt();
//
// Initial update of the screen.
//
UIUpdateStatus();
}
示例10: UpdateButtons
//*****************************************************************************
//
// This function will update the small mouse button indicators in the status
// bar area of the screen. This can be called on its own or it will be called
// whenever UpdateStatus() is called as well.
//
//*****************************************************************************
void
UpdateButtons(void)
{
tRectangle sRect, sRectInner;
int iButton;
//
// Initialize the button indicator position.
//
sRect.i16XMin = GrContextDpyWidthGet(&g_sContext) - 36;
sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - 18;
sRect.i16XMax = sRect.i16XMin + 6;
sRect.i16YMax = sRect.i16YMin + 8;
sRectInner.i16XMin = sRect.i16XMin + 1;
sRectInner.i16YMin = sRect.i16YMin + 1;
sRectInner.i16XMax = sRect.i16XMax - 1;
sRectInner.i16YMax = sRect.i16YMax - 1;
//
// Check all three buttons.
//
for(iButton = 0; iButton < 3; iButton++)
{
//
// Draw the button indicator red if pressed and black if not pressed.
//
if(g_ui32Buttons & (1 << iButton))
{
GrContextForegroundSet(&g_sContext, ClrRed);
}
else
{
GrContextForegroundSet(&g_sContext, ClrBlack);
}
//
// Draw the back of the button indicator.
//
GrRectFill(&g_sContext, &sRectInner);
//
// Draw the border on the button indicator.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrRectDraw(&g_sContext, &sRect);
//
// Move to the next button indicator position.
//
sRect.i16XMin += 8;
sRect.i16XMax += 8;
sRectInner.i16XMin += 8;
sRectInner.i16XMax += 8;
}
}
示例11: main
//*****************************************************************************
//
// Print "Hello World!" to the display on the Intelligent Display Module.
//
//*****************************************************************************
int
main(void)
{
tContext sContext;
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(&sContext, &g_sKentec320x240x16_SSD2119);
//
// Draw the application frame.
//
FrameDraw(&sContext, "hello");
//
// Say hello using the Computer Modern 40 point font.
//
GrContextFontSet(&sContext, g_psFontCm40);
GrStringDrawCentered(&sContext, "Hello World!", -1,
GrContextDpyWidthGet(&sContext) / 2,
((GrContextDpyHeightGet(&sContext) - 32) / 2) + 24,
0);
//
// Flush any cached drawing operations.
//
GrFlush(&sContext);
//
// We are finished. Hang around doing nothing.
//
while(1)
{
}
}
示例12: 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;
int32_t i32Y;
//
// Calculate the Y coordinate of the top left of the character cell
// for our line of text.
//
i32Y = (GrContextDpyHeightGet(psContext) / 4) -
(GrFontHeightGet(TEXT_FONT) / 2);
//
// 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.
//
rectLine.i16XMin = 0;
rectLine.i16XMax = GrContextDpyWidthGet(psContext) - 1;
rectLine.i16YMin = i32Y;
rectLine.i16YMax = i32Y + GrFontHeightGet(TEXT_FONT) + 3;
//
// Clear the line with black.
//
GrContextForegroundSet(&g_sContext, ClrBlack);
GrRectFill(psContext, &rectLine);
//
// Draw the new status string
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrStringDrawCentered(psContext, pcStatus, -1,
GrContextDpyWidthGet(psContext) / 2,
GrContextDpyHeightGet(psContext) / 4 , false);
}
示例13: 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);
}
示例14: 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);
}
示例15: 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, tBoolean bClrBackground)
{
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;
//
//
//
GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG);
if(bClrBackground)
{
//
// 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);
}
//
// Write the current state to the left of the status area.
//
GrContextFontSet(&g_sContext, g_pFontFixed6x8);
//
// Update the status on the screen.
//
if(pcString != 0)
{
GrStringDraw(&g_sContext, pcString, -1, 4, sRect.sYMin + 4, 1);
}
}