您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GrContextDpyWidthGet函数代码示例

51自学网 2021-06-01 21:19:16
  C++
这篇教程C++ GrContextDpyWidthGet函数代码示例写得很实用,希望能帮到您。

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

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

示例1: main

//.........这里部分代码省略.........               BMP180AppCallback, &g_sBMP180Inst);    //    // Wait for initialization callback to indicate reset request is complete.    //    while(g_vui8DataFlag == 0)    {        //        // Wait for I2C Transactions to complete.        //    }    //    // Reset the data ready flag    //    g_vui8DataFlag = 0;    //    // Enable the system ticks at 10 hz.    //    MAP_SysTickPeriodSet(ui32SysClock / (10 * 3));    MAP_SysTickIntEnable();    MAP_SysTickEnable();    //    // Configure PQ4 to control the blue LED.    //    MAP_GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_4);    //    // Print temperature, pressure and altitude labels once on the LCD.    //    GrStringDraw(&sContext, "Temperature", 11,                 ((GrContextDpyWidthGet(&sContext) / 2) - 96),                 ((GrContextDpyHeightGet(&sContext) - 32) / 2) - 24, 1);    GrStringDraw(&sContext, "Pressure", 8,                 ((GrContextDpyWidthGet(&sContext) / 2) - 63),                 (GrContextDpyHeightGet(&sContext) - 32) / 2, 1);    GrStringDraw(&sContext, "Altitude", 8,                 ((GrContextDpyWidthGet(&sContext) / 2) - 59),                 ((GrContextDpyHeightGet(&sContext) - 32) / 2) + 24, 1);    //    // Begin the data collection and printing.  Loop Forever.    //    while(1)    {        //        // Read the data from the BMP180 over I2C.  This command starts a        // temperature measurement.  Then polls until temperature is ready.        // Then automatically starts a pressure measurement and polls for that        // to complete.  When both measurement are complete and in the local        // buffer then the application callback is called from the I2C        // interrupt context.  Polling is done on I2C interrupts allowing        // processor to continue doing other tasks as needed.        //        BMP180DataRead(&g_sBMP180Inst, BMP180AppCallback, &g_sBMP180Inst);        while(g_vui8DataFlag == 0)        {            //            // Wait for the new data set to be available.            //        }        //        // Reset the data ready flag.
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:67,


示例2: main

//.........这里部分代码省略.........    GrStringDraw(&sContext, "Touch center of circles to calibrate", -1, 0, 0, 1);    GrCircleDraw(&sContext, 32, 24, 10);    GrFlush(&sContext);    TouchScreenCalibrationPoint(32, 24, 0);    GrCircleDraw(&sContext, 280, 200, 10);    GrFlush(&sContext);    TouchScreenCalibrationPoint(280, 200, 1);    GrCircleDraw(&sContext, 200, 40, 10);    GrFlush(&sContext);    TouchScreenCalibrationPoint(200, 40, 2);    //    // Calculate and set calibration matrix    //    long* plCalibrationMatrix = TouchScreenCalibrate();        //    // Write out calibration data if successful    //    if(plCalibrationMatrix)    {    	char pcStringBuf[20];    	usprintf(pcStringBuf, "A %d", plCalibrationMatrix[0]);    	GrStringDraw(&sContext, pcStringBuf, -1, 0, 20, 1);    	usprintf(pcStringBuf, "B %d", plCalibrationMatrix[1]);    	GrStringDraw(&sContext, pcStringBuf, -1, 0, 40, 1);    	usprintf(pcStringBuf, "C %d", plCalibrationMatrix[2]);    	GrStringDraw(&sContext, pcStringBuf, -1, 0, 60, 1);    	usprintf(pcStringBuf, "D %d", plCalibrationMatrix[3]);    	GrStringDraw(&sContext, pcStringBuf, -1, 0, 80, 1);    	usprintf(pcStringBuf, "E %d", plCalibrationMatrix[4]);    	GrStringDraw(&sContext, pcStringBuf, -1, 0, 100, 1);    	usprintf(pcStringBuf, "F %d", plCalibrationMatrix[5]);    	GrStringDraw(&sContext, pcStringBuf, -1, 0, 120, 1);    	usprintf(pcStringBuf, "Div %d", plCalibrationMatrix[6]);    	GrStringDraw(&sContext, pcStringBuf, -1, 0, 140, 1);    	TouchScreenCalibrationPoint(0,0,0);	// wait for dummy touch    }    //    // Enable touch screen event handler for grlib widgets    //    TouchScreenCallbackSet(WidgetPointerMessage);    //    // Fill the top 24 rows of the screen with blue to create the banner.    //    sRect.sXMin = 0;    sRect.sYMin = 0;    sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;    sRect.sYMax = 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);    //    // 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.    //    while(1)    {        //        // Process any messages in the widget message queue.        //        WidgetMessageQueueProcess();    }}
开发者ID:astuder,项目名称:Stellaris-grlib-driver-Adafruit-TFT-ILI9325,代码行数:101,


示例3: main

//*****************************************************************************//// A simple demonstration of the features of the TivaWare 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();    //    // Run from the PLL at 120 MHz.    //    g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |                                            SYSCTL_OSC_MAIN |                                            SYSCTL_USE_PLL |                                            SYSCTL_CFG_VCO_480), 120000000);    //    // Initialize the display driver.    //    Kentec320x240x16_SSD2119Init(g_ui32SysClock);    //    // 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(&psDMAControlTable[0]);    uDMAEnable();    //    // Initialize the touch screen driver and have it route its messages to the    // widget tree.    //    TouchScreenInit(g_ui32SysClock);    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_ui32Panel = 0;    WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels);    CanvasTextSet(&g_sTitle, g_pcPanei32Names[0]);    //    // Issue the initial paint request to the widgets.    //    WidgetPaint(WIDGET_ROOT);//.........这里部分代码省略.........
开发者ID:peterliu2,项目名称:tivaWare,代码行数:101,


示例4: main

//*****************************************************************************//// This is the main example program.  It checks to see that the interrupts are// processed in the correct order when they have identical priorities,// increasing priorities, and decreasing priorities.  This exercises interrupt// preemption and tail chaining.////*****************************************************************************intmain(void){    uint_fast8_t ui8Error;    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, "interrupts");    //    // Put the status header text on the display.    //    GrContextFontSet(&g_sContext, g_psFontCm20);    GrStringDrawCentered(&g_sContext, "Active:      Pending:     ", -1,                 GrContextDpyWidthGet(&g_sContext) / 2, 150, 0);    //    // Configure the B3, L1 and L0 to be outputs to indicate entry/exit of one    // of the interrupt handlers.    //    GPIOPinTypeGPIOOutput(GPIO_A_BASE, GPIO_A_PIN);    GPIOPinTypeGPIOOutput(GPIO_B_BASE, GPIO_B_PIN);    GPIOPinTypeGPIOOutput(GPIO_C_BASE, GPIO_C_PIN);    GPIOPinWrite(GPIO_A_BASE, GPIO_A_PIN, 0);    GPIOPinWrite(GPIO_B_BASE, GPIO_B_PIN, 0);    GPIOPinWrite(GPIO_C_BASE, GPIO_C_PIN, 0);    //    // Set up and enable the SysTick timer.  It will be used as a reference    // for delay loops in the interrupt handlers.  The SysTick timer period    // will be set up for 100 times per second.    //    ROM_SysTickPeriodSet(ui32SysClock / 100);    ROM_SysTickEnable();    //    // Reset the error indicator.    //    ui8Error = 0;    //    // Enable interrupts to the processor.    //    ROM_IntMasterEnable();    //    // Enable the interrupts.    //    ROM_IntEnable(INT_GPIOA);    ROM_IntEnable(INT_GPIOB);    ROM_IntEnable(INT_GPIOC);    //    // Indicate that the equal interrupt priority test is beginning.    //    GrStringDrawCentered(&g_sContext, "Equal Priority", -1,                         GrContextDpyWidthGet(&g_sContext) / 2, 60, 1);    //    // Set the interrupt priorities so they are all equal.    //    ROM_IntPrioritySet(INT_GPIOA, 0x00);    ROM_IntPrioritySet(INT_GPIOB, 0x00);    ROM_IntPrioritySet(INT_GPIOC, 0x00);    //    // Reset the interrupt flags.    ////.........这里部分代码省略.........
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:101,


示例5: AcquireInit

//*****************************************************************************//// This function initializes the ADC hardware in preparation for data// acquisition.////*****************************************************************************voidAcquireInit(void){    unsigned long ulChan;    //    // Enable the ADC peripherals and the associated GPIO port    //    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);    ROM_SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS);    ROM_GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 |GPIO_PIN_7 | GPIO_PIN_3);    ROM_GPIOPinTypeADC(GPIO_PORTP_BASE, GPIO_PIN_0);//    ROM_ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);    //ROM_ADCR    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);    HWREG(GPIO_PORTB_BASE + GPIO_O_AMSEL) |= GPIO_PIN_6;    ADCSequenceDisable(ADC0_BASE,SEQUENCER);    ROM_ADCSequenceConfigure(ADC0_BASE, SEQUENCER, ADC_TRIGGER_TIMER, 0);    for(ulChan = 0; ulChan < 2; ulChan++)    {        unsigned long ulChCtl;        if (ulChan ==1)        {            ROM_ADCSequenceStepConfigure(ADC0_BASE, SEQUENCER, ulChan, ADC_CTL_CH1|ADC_CTL_IE | ADC_CTL_END);        }        else if(ulChan==0)        {        	ulChCtl = ADC_CTL_CH0;        	ROM_ADCSequenceStepConfigure(ADC0_BASE, SEQUENCER, ulChan, ADC_CTL_CH0);        }    }    ADCHardwareOversampleConfigure(ADC0_BASE, 1);    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);    //SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);    ROM_TimerConfigure(TIMER0_BASE,TIMER_CFG_32_BIT_PER );    //100 micro    unsigned long freq=SAMPLING_FREQUENCY;    unsigned long period=(2*ROM_SysCtlClockGet()/(freq));    ROM_TimerLoadSet(TIMER0_BASE, TIMER_A,period);    ROM_TimerControlTrigger(TIMER0_BASE, TIMER_A, true);    //ROM_TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC);    //ROM_TimerLoadSet(TIMER1_BASE, TIMER_A, ROM_SysCtlClockGet() /2);    CFAL96x64x16Init();    GrContextInit(&sDisplayContext, &g_sCFAL96x64x16);    sRect1.sXMin = 0;    sRect1.sYMin = 0;    sRect1.sXMax = GrContextDpyWidthGet(&sDisplayContext) - 1;    sRect1.sYMax = 23;    sRect2.sXMin = 0;    sRect2.sYMin = 23;    sRect2.sXMax = GrContextDpyWidthGet(&sDisplayContext) - 1;    sRect2.sYMax = GrContextDpyHeightGet(&sDisplayContext) - 1;	snprintf(text,sizeof(text),"STart");    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, &sRect1);    //GrContextForegroundSet(&sDisplayContext, ClrWhite);    //GrRectDraw(&sDisplayContext, &sRect1);    /*GrContextForegroundSet(&sDisplayContext, ClrDarkBlue);//.........这里部分代码省略.........
开发者ID:pi19404,项目名称:Embedded,代码行数:101,


示例6: main

//*****************************************************************************//// A simple application demonstrating use of the boot loader,////*****************************************************************************intmain(void){    tRectangle sRect;    tContext sContext;    unsigned long ulSysClock;    //    // 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_XTAL_16MHZ |                       SYSCTL_OSC_MAIN);    ulSysClock = ROM_SysCtlClockGet();    //    // Initialize the peripherals that each of the boot loader flavors    // supports.  Since this example is intended for use with any of the    // boot loaders and we don't know which is actually in use, we cover all    // bases and initialize for serial, Ethernet and USB use here.    //    SetupForUART();    SetupForUSB();    //    // Initialize the buttons driver.    //    ButtonsInit();    //    // 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.sXMin = 0;    sRect.sYMin = 0;    sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;    sRect.sYMax = 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_pFontFixed6x8);    GrStringDrawCentered(&sContext, "boot-demo2", -1,                         GrContextDpyWidthGet(&sContext) / 2, 4, 0);    GrStringDrawCentered(&sContext, "Press select", -1,                         GrContextDpyWidthGet(&sContext) / 2, 20, false);    GrStringDrawCentered(&sContext, "button to", -1,                         GrContextDpyWidthGet(&sContext) / 2, 30, false);    GrStringDrawCentered(&sContext, "update.", -1,                         GrContextDpyWidthGet(&sContext) / 2, 40, false);       //    // Wait for select button to be pressed.    //     while ((ButtonsPoll(0, 0) & SELECT_BUTTON) == 0)     {        ROM_SysCtlDelay(ulSysClock / 1000);    }    GrStringDrawCentered(&sContext, "             ", -1,                         GrContextDpyWidthGet(&sContext) / 2, 20, true);    GrStringDrawCentered(&sContext, " Updating... ", -1,                         GrContextDpyWidthGet(&sContext) / 2, 30, true);    GrStringDrawCentered(&sContext, "             ", -1,                         GrContextDpyWidthGet(&sContext) / 2, 40, true);    //    // Transfer control to the boot loader.    //    JumpToBootLoader();    ////.........这里部分代码省略.........
开发者ID:Razofiter,项目名称:Luminary-Micro-Library,代码行数:101,


示例7: UpdateStatus

//*****************************************************************************//// This function updates the status area of the screen.  It uses the current// state of the application to print the status bar.////*****************************************************************************voidUpdateStatus(char *pcString, uint32_t ui32Buttons, bool bClrBackground){    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;    //    // Were we asked to clear the background of the status area?    //    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_psFontFixed6x8);    //    // Update the status on the screen.    //    if(pcString != 0)    {        UARTprintf(pcString);        UARTprintf("/n");        GrStringDraw(&g_sContext, pcString, -1, 10, sRect.i16YMin + 4, 1);        g_ui32Buttons = ui32Buttons;    }    else if(iUSBState == eStateNoDevice)    {        //        // Mouse is currently disconnected.        //        UARTprintf("no device/n");        GrStringDraw(&g_sContext, "no device     ", -1, 10, sRect.i16YMin + 4,                     1);    }    else if(iUSBState == eStateMouseConnected)    {        //        // Mouse is connected.        //        UARTprintf("connected/n");        GrStringDraw(&g_sContext, "connected     ", -1, 10, sRect.i16YMin + 4,                     1);    }    else if(iUSBState == eStateUnknownDevice)    {        //        // Some other (unknown) device is connected.        //        UARTprintf("unknown device/n");        GrStringDraw(&g_sContext, "unknown device", -1, 10, sRect.i16YMin + 4,                     1);    }    else if(iUSBState == eStatePowerFault)    {        //        // Power fault.        //        UARTprintf("power fault/n");        GrStringDraw(&g_sContext, "power fault   ", -1, 10, sRect.i16YMin + 4,                     1);    }    UpdateButtons();}
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:95,


示例8: 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) {        //        // See if the button is pressed.//.........这里部分代码省略.........
开发者ID:peterliu2,项目名称:tivaWare,代码行数:101,


示例9: main

//*****************************************************************************//// This is the main loop that runs the application.////*****************************************************************************intmain(void){    FRESULT FileResult;    tRectangle sRect;    //    // Initially wait for device connection.    //    g_eState = STATE_NO_DEVICE;    //    // Set the clocking to run directly from the crystal.    //    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |                   SYSCTL_XTAL_8MHZ);    //    // Enable Clocking to the USB controller.    //    SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);    //    // Enable the peripherals used by this example.    //    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);    //    // Set the USB pins to be controlled by the USB controller.    //    GPIOPinTypeUSBDigital(GPIO_PORTH_BASE, GPIO_PIN_3 | GPIO_PIN_4);    //    // The LM3S3748 board uses a USB mux that must be switched to use the    // host connecter and not the device connecter.    //    GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN);    GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_HOST);    //    // Turn on USB Phy clock.    //    SysCtlUSBPLLEnable();    //    // Set the system tick to fire 100 times per second.    //    SysTickPeriodSet(SysCtlClockGet()/100);    SysTickIntEnable();    SysTickEnable();    //    // Enable the uDMA controller and set up the control table base.    //    SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);    uDMAEnable();    uDMAControlBaseSet(g_sDMAControlTable);    //    // 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 = SPLASH_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_sFontFixed6x8);//.........这里部分代码省略.........
开发者ID:fejerson108,项目名称:Stellarisware,代码行数:101,


示例10: 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:AlexGeControl,项目名称:tiva-c,代码行数:101,


示例11: main

//*****************************************************************************//// This example demonstrates the use of the watchdog timer.////*****************************************************************************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_16MHZ);    //    // Set the device pinout appropriately for this board.    //    PinoutSet();    //    // Initialize the touch screen driver.    //    TouchScreenInit();    TouchScreenCallbackSet(WatchdogTouchCallback);    //    // Initialize the display driver.    //    Kitronix320x240x16_SSD2119Init();    //    // Initialize the graphics context and find the middle X coordinate.    //    GrContextInit(&g_sContext, &g_sKitronix320x240x16_SSD2119);    //    // 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_pFontCm20);    GrStringDrawCentered(&g_sContext, "watchdog", -1,                         GrContextDpyWidthGet(&g_sContext) / 2, 8, 0);    //    // Show the state and offer some instructions to the user.    //    GrContextFontSet(&g_sContext, g_pFontCmss20);    GrStringDrawCentered(&g_sContext, "Watchdog is being fed.", -1,                         GrContextDpyWidthGet(&g_sContext) / 2 ,                         (GrContextDpyHeightGet(&g_sContext) / 2), 1);    GrContextFontSet(&g_sContext, g_pFontCmss14);    GrStringDrawCentered(&g_sContext, "Tap the screen to starve the watchdog",                         -1, GrContextDpyWidthGet(&g_sContext) / 2 ,                         (GrContextDpyHeightGet(&g_sContext) / 2) + 20, 1);    //    // Enable the peripherals used by this example.    //    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);    //    // Enable processor interrupts.    //    ROM_IntMasterEnable();    //    // Set GPIO PF3 as an output.  This drives an LED on the board that will    // toggle when a watchdog interrupt is processed.    //    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3);    ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0);    //    // Enable the watchdog interrupt.    //    ROM_IntEnable(INT_WATCHDOG);    //    // Set the period of the watchdog timer.    //    ROM_WatchdogReloadSet(WATCHDOG0_BASE, ROM_SysCtlClockGet());    ////.........这里部分代码省略.........
开发者ID:Razofiter,项目名称:Luminary-Micro-Library,代码行数:101,


示例12: main

//*****************************************************************************//// This example decrypts blocks ciphertext using AES128 and AES256 in GCM// mode.  It does the decryption first without uDMA and then with uDMA.// The results are checked after each operation.////*****************************************************************************intmain(void){    uint32_t pui32PlainText[64], pui32Tag[4], pui32Y0[4], ui32Errors, ui32Idx;    uint32_t *pui32Key, ui32IVLength, *pui32IV, ui32DataLength;    uint32_t *pui32ExpPlainText, ui32AuthDataLength, *pui32AuthData;    uint32_t *pui32CipherText, *pui32ExpTag;    uint32_t ui32KeySize;    uint32_t ui32SysClock;    uint8_t ui8Vector;    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, "aes-gcm-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;    }    for(ui32Idx = 0; ui32Idx < 4; ui32Idx++)    {        pui32Tag[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 AES interrupts.    //    ROM_IntEnable(INT_AES0);    //    // Enable debug output on UART0 and print a welcome message.    //    ConfigureUART();    UARTprintf("Starting AES GCM 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.    ////.........这里部分代码省略.........
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,


示例13: main

/****************************************************************************** *  This is the main loop that runs the application.* *****************************************************************************/int main(void){    tRectangle sRect;    MMUConfigAndEnable();    	/* Enable USB module clock */		USB0ModuleClkConfig();	/* configures arm interrupt controller to generate raster interrupt  */		USBInterruptEnable();	/* LCD Back light setup */		LCDBackLightEnable();	/* UPD Pin setup */		UPDNPinControl();	/* Delay timer setup */		DelayTimerSetup();	/* Configures raster to display image  */		SetUpLCD();			/* Configures raster to display image  and Copy palette info into buffer */		LCDInit();	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 24 rows of the screen with blue to create the banner. */	sRect.sXMin = 0;	sRect.sYMin = 0;	sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;	sRect.sYMax = (MAX_ROW_NUM - 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_sFontCm20);	GrStringDrawCentered(&g_sContext, "usb-dev-composite", -1,						 GrContextDpyWidthGet(&g_sContext) / 2, 10, 0);		     /* Show the various static text elements on the color STN display. */          GrContextFontSet(&g_sContext, TEXT_FONT); 	 GrContextForegroundSet(&g_sContext, ClrViolet);     GrStringDraw(&g_sContext, "CDC Serial 1 :-", -1, CDC1_STR_X_POSITION,                   CDC1_STR_Y_POSITION, false);     GrStringDraw(&g_sContext, "CDC Serial 2 :-", -1, CDC2_STR_X_POSITION,                   CDC1_STR_Y_POSITION, false); 	 GrContextForegroundSet(&g_sContext, ClrWhite); 	 GrStringDraw(&g_sContext, "Tx bytes:", -1, CDC1_STR_X_POSITION, 	              (CDC1_STR_Y_POSITION + CDC_STR_Y_DIFF), false);     GrStringDraw(&g_sContext, "Tx buffer:", -1, CDC1_STR_X_POSITION,                  (CDC1_STR_Y_POSITION + (CDC_STR_Y_DIFF * 2)), false);     GrStringDraw(&g_sContext, "Rx bytes:", -1, CDC1_STR_X_POSITION,                   (CDC1_STR_Y_POSITION + (CDC_STR_Y_DIFF * 4)), false);     GrStringDraw(&g_sContext, "Rx buffer:", -1, CDC1_STR_X_POSITION,                   (CDC1_STR_Y_POSITION + (CDC_STR_Y_DIFF * 5)), false);     DrawBufferMeter(&g_sContext, CDC1_BUF_METER_X_POS, CDC1_BUF_METER_Y_POS);     DrawBufferMeter(&g_sContext, CDC1_BUF_METER_X_POS,                     (CDC1_BUF_METER_Y_POS + CDC_BUF_METER_Y_DIFF)); 	 GrStringDraw(&g_sContext, "Tx bytes:", -1, CDC2_STR_X_POSITION,  	              (CDC2_STR_Y_POSITION + CDC_STR_Y_DIFF), false);     GrStringDraw(&g_sContext, "Tx buffer:", -1, CDC2_STR_X_POSITION,                  (CDC2_STR_Y_POSITION + (CDC_STR_Y_DIFF * 2)), false);     GrStringDraw(&g_sContext, "Rx bytes:", -1, CDC2_STR_X_POSITION,                   (CDC2_STR_Y_POSITION + (CDC_STR_Y_DIFF * 4)), false);     GrStringDraw(&g_sContext, "Rx buffer:", -1, CDC2_STR_X_POSITION,                   (CDC2_STR_Y_POSITION + (CDC_STR_Y_DIFF * 5)), false);     DrawBufferMeter(&g_sContext, CDC2_BUF_METER_X_POS, CDC2_BUF_METER_Y_POS);     DrawBufferMeter(&g_sContext, CDC2_BUF_METER_X_POS, //.........这里部分代码省略.........
开发者ID:OS-Project,项目名称:Divers,代码行数:101,


示例14: main

//*****************************************************************************//// This example encrypts a block of payload using AES128 in CCM mode.  It// does the encryption first without uDMA and then with uDMA.  The results// are checked after each operation.////*****************************************************************************intmain(void){    uint32_t pui32CipherText[16], pui32Tag[4], ui32Errors, ui32Idx;    uint32_t ui32PayloadLength, ui32TagLength;    uint32_t ui32NonceLength, ui32AuthDataLength;    uint32_t *pui32Nonce, *pui32AuthData, ui32SysClock;    uint32_t *pui32Key, *pui32Payload, *pui32ExpCipherText;    uint32_t ui32Keysize;    uint8_t ui8Vector;    uint8_t *pui8ExpTag, *pui8Tag;    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, "aes-ccm-encrypt");        //    // Show some instructions on the display    //    GrContextFontSet(&sContext, g_psFontCm20);    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++)    {        pui32CipherText[ui32Idx] = 0;    }    for(ui32Idx = 0; ui32Idx < 4; ui32Idx++)    {        pui32Tag[ui32Idx] = 0;    }    pui8Tag = (uint8_t *)pui32Tag;    //    // Enable stacking for interrupt handlers.  This allows floating-point    // instructions to be used within interrupt handlers, but at the expense of    // extra stack usage.    //    ROM_FPUStackingEnable();    //    // Configure the system clock to run off the internal 16MHz oscillator.    //    MAP_SysCtlClockFreqSet(SYSCTL_OSC_INT | SYSCTL_USE_OSC, 16000000);    //    // Enable AES interrupts.    //    ROM_IntEnable(INT_AES0);    //    // Enable debug output on UART0 and print a welcome message.    //    ConfigureUART();    UARTprintf("Starting AES CCM encryption demo./n");    GrStringDrawCentered(&sContext, "Starting demo...", -1,                         GrContextDpyWidthGet(&sContext) / 2, 140, false);    //    // Enable the uDMA module.//.........这里部分代码省略.........
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:101,


示例15: UpdateStatus

//*****************************************************************************//// This function updates the status area of the screen.  It uses the current// state of the application to print the status bar.////*****************************************************************************voidUpdateStatus(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:RoboEvangelist,项目名称:TivaWare_C_Series-2.1.0.12573,代码行数:77,


示例16: main

//*****************************************************************************//// This example encrypts blocks of plaintext using TDES in CBC mode.  It// does the encryption first without uDMA and then with uDMA.  The results// are checked after each operation.////*****************************************************************************intmain(void){    uint32_t pui32CipherText[16], ui32Errors, ui32Idx, ui32SysClock;    tContext sContext;        //    // Run from the PLL at 120 MHz.    //    ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |                                       SYSCTL_OSC_MAIN |                                       SYSCTL_USE_PLL |                                       SYSCTL_CFG_VCO_480), 120000000);    //    // Configure the device pins.    //    PinoutSet();    //    // Initialize the display driver.    //    Kentec320x240x16_SSD2119Init(ui32SysClock);    //    // Initialize the graphics context.    //    GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);    //    // Draw the application frame.    //    FrameDraw(&sContext, "tdes-cbc-encrypt");        //    // 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++)    {        pui32CipherText[ui32Idx] = 0;    }    //    // Enable stacking for interrupt handlers.  This allows floating-point    // instructions to be used within interrupt handlers, but at the expense of    // extra stack usage.    //    ROM_FPUStackingEnable();    //    // Enable DES interrupts.    //    ROM_IntEnable(INT_DES0);    //    // Enable debug output on UART0 and print a welcome message.    //    ConfigureUART();    UARTprintf("Starting TDES CBC encryption demo./n");    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:bli19,项目名称:unesp_mdt,代码行数:101,


示例17: main

//*****************************************************************************//// This is the main loop that runs the application.////*****************************************************************************intmain(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:RoboEvangelist,项目名称:TivaWare_C_Series-2.1.0.12573,代码行数:101,


示例18: main

//*****************************************************************************//// Run the AES encryption/decryption example////*****************************************************************************intmain(void){    unsigned char ucBlockBuf[17];    const unsigned *puKey;    unsigned char ucTempIV[16];    tContext sContext;    tRectangle sRect;    long lCenterX;    //    // Set the clocking to run directly from the crystal.    //    ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |                       SYSCTL_XTAL_16MHZ);    //    // Set the pinout appropriately for this board.    //    PinoutSet();    //    // Initialize the display driver.    //    Kitronix320x240x16_SSD2119Init();    //    // Initialize the graphics context and find the middle X coordinate.    //    GrContextInit(&sContext, &g_sKitronix320x240x16_SSD2119);    lCenterX = GrContextDpyWidthGet(&sContext) / 2;    //    // Fill the top 15 rows of the screen with blue to create the banner.    //    sRect.sXMin = 0;    sRect.sYMin = 0;    sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;    sRect.sYMax = 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_pFontCm20);    GrStringDrawCentered(&sContext, "aes-expanded-key", -1, lCenterX, 8, 0);    //    // Print the plain text title    //    GrContextFontSet(&sContext, g_pFontCmss22b);    GrStringDrawCentered(&sContext, "Plain Text:", -1, lCenterX, 60, 0);    GrStringDrawCentered(&sContext, g_cPlainText, -1, lCenterX, 85, 0);    //    // Get the expanded key to use for encryption    //    puKey = AESExpandedEncryptKeyData();    //    // Generate the initialization vector needed for CBC mode.    // A temporary copy is made that will be used with the crypt    // function because the crypt function will modify the IV that is passed.    //    AESGenerateIV(g_ucIV, 1);    memcpy(ucTempIV, g_ucIV, 16);    //    // Encrypt the plaintext message using CBC mode    //    aes_crypt_cbc(puKey, AES_ENCRYPT, 16, ucTempIV,                  (unsigned char *)g_cPlainText, ucBlockBuf);    //    // Print the encrypted block to the display.  Note that it will    // appear as nonsense data.  The block needs to be null terminated    // so that the StringDraw function will work correctly.    //    ucBlockBuf[16] = 0;    GrStringDrawCentered(&sContext, "Encrypted:", -1, lCenterX, 120, 0);    GrStringDrawCentered(&sContext, (char *)ucBlockBuf, -1, lCenterX, 145, 0);    //    // Get the expanded key to use for decryption    //    puKey = AESExpandedDecryptKeyData();    ////.........这里部分代码省略.........
开发者ID:yangjunjiao,项目名称:Luminary-Micro-Library,代码行数:101,


示例19: UpdateCursor

//*****************************************************************************//// This function updates the cursor position based on deltas received from// the mouse device.//// /param i32XDelta is the signed movement in the X direction.// /param i32YDelta is the signed movement in the Y direction.//// This function is called by the mouse handler code when it detects a change// in the position of the mouse.  It will take the inputs and force them// to be constrained to the display area of the screen.  If the left mouse// button is pressed then the mouse will draw on the screen and if it is not// it will move around normally.  A side effect of not being able to read the// current state of the screen is that the cursor will erase anything it moves// over while the left mouse button is not pressed.//// /return None.////*****************************************************************************voidUpdateCursor(int32_t i32XDelta, int32_t i32YDelta){    int32_t i32Temp;    //    // If the left button is not pressed then erase the previous cursor    // position.    //    if((g_ui32Buttons & 1) == 0)    {        //        // Erase the previous cursor.        //        GrContextForegroundSet(&g_sContext, DISPLAY_MOUSE_BG);        GrRectFill(&g_sContext, &g_sCursor);    }    //    // Need to do signed math so use the temporary signed value.    //    i32Temp = g_sCursor.i16XMin;    //    // Update the X position without going off the screen.    //    if(((int)g_sCursor.i16XMin + i32XDelta + DISPLAY_MOUSE_SIZE) <       GrContextDpyWidthGet(&g_sContext))    {        //        // Update the X cursor position.        //        i32Temp += i32XDelta;        //        // Don't let the cursor go off the left of the screen either.        //        if(i32Temp < 0)        {            i32Temp = 0;        }    }    //    // Update the X position.    //    g_sCursor.i16XMin = i32Temp;    g_sCursor.i16XMax = i32Temp + DISPLAY_MOUSE_SIZE;    //    // Need to do signed math so use the temporary signed value.    //    i32Temp = g_sCursor.i16YMin;    //    // Update the Y position without going off the screen.    //    if(((int)g_sCursor.i16YMin + i32YDelta) <       (GrContextDpyHeightGet(&g_sContext) -        DISPLAY_BANNER_HEIGHT - DISPLAY_MOUSE_SIZE - 1))    {        //        // Update the Y cursor position.        //        i32Temp += i32YDelta;        //        // Don't let the cursor overwrite the status area of the screen.        //        if(i32Temp < DISPLAY_BANNER_HEIGHT + 1)        {            i32Temp = DISPLAY_BANNER_HEIGHT + 1;        }    }    //    // Update the Y position.    //    g_sCursor.i16YMin = i32Temp;    g_sCursor.i16YMax = i32Temp + DISPLAY_MOUSE_SIZE;//.........这里部分代码省略.........
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:101,


示例20: main

//*****************************************************************************//// This example application demonstrates the use of the timers to generate// periodic interrupts.////*****************************************************************************intmain(void){    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 display driver.    //    CFAL96x64x16Init();    //    // Initialize the graphics context and find the middle X coordinate.    //    GrContextInit(&g_sContext, &g_sCFAL96x64x16);    //    // Fill the top part of the screen with blue to create the banner.    //    sRect.sXMin = 0;    sRect.sYMin = 0;    sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;    sRect.sYMax = 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_pFontFixed6x8);    GrStringDrawCentered(&g_sContext, "timers", -1,                         GrContextDpyWidthGet(&g_sContext) / 2, 4, 0);    //    // Initialize timer status display.    //    GrContextFontSet(&g_sContext, g_pFontFixed6x8);    GrStringDraw(&g_sContext, "Timer 0:", -1, 16, 26, 0);    GrStringDraw(&g_sContext, "Timer 1:", -1, 16, 36, 0);    //    // Enable the peripherals used by this example.    //    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);    //    // Enable processor interrupts.    //    ROM_IntMasterEnable();    //    // Configure the two 32-bit periodic timers.    //    ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);    ROM_TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC);    ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet());    ROM_TimerLoadSet(TIMER1_BASE, TIMER_A, ROM_SysCtlClockGet() / 2);    //    // Setup the interrupts for the timer timeouts.    //    ROM_IntEnable(INT_TIMER0A);    ROM_IntEnable(INT_TIMER1A);    ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);    ROM_TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT);    //    // Enable the timers.    //    ROM_TimerEnable(TIMER0_BASE, TIMER_A);    ROM_TimerEnable(TIMER1_BASE, TIMER_A);    //    // Loop forever while the timers run.    //    while(1)//.........这里部分代码省略.........
开发者ID:wuweijia1994,项目名称:LM4F232H5QD,代码行数:101,


示例21: main

//*****************************************************************************//// This is the main example program.  It checks to see that the interrupts are// processed in the correct order when they have identical priorities,// increasing priorities, and decreasing priorities.  This exercises interrupt// preemption and tail chaining.////*****************************************************************************intmain(void){    tRectangle sRect;    uint_fast8_t ui8Error;    //    // Enable lazy stacking for interrupt handlers.  This allows floating-point    // instructions to be used within interrupt handlers, but at the expense of    // extra stack usage.    //    ROM_FPULazyStackingEnable();    //    // Set the clocking to run directly from the crystal.    //    ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |                       SYSCTL_XTAL_16MHZ);    //    // Enable the peripherals used by this example.    //    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);    //    // Initialize the display driver.    //    CFAL96x64x16Init();    //    // Initialize the graphics context and find the middle X coordinate.    //    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, "interrupts", -1,                         GrContextDpyWidthGet(&g_sContext) / 2, 4, 0);    GrContextFontSet(&g_sContext, g_psFontFixed6x8);    //    // Put the status header text on the display.    //    GrStringDraw(&g_sContext, "Active:", -1, 6, 32, 0);    GrStringDraw(&g_sContext, "Pending:", -1, 0, 44, 0);    //    // Configure the PB0-PB2 to be outputs to indicate entry/exit of one    // of the interrupt handlers.    //    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 |                                               GPIO_PIN_3);    ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2, 0);    //    // Set up and enable the SysTick timer.  It will be used as a reference    // for delay loops in the interrupt handlers.  The SysTick timer period    // will be set up for one second.    //    ROM_SysTickPeriodSet(ROM_SysCtlClockGet());    ROM_SysTickEnable();    //    // Reset the error indicator.    //    ui8Error = 0;    //    // Enable interrupts to the processor.    //    ROM_IntMasterEnable();    //    // Enable the interrupts.    ////.........这里部分代码省略.........
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,


示例22: main

//*****************************************************************************//// A simple demonstration of the features of the Stellaris Graphics Library.////*****************************************************************************intmain(void){    unsigned long ulIdx;    tRectangle sRect;    //    // Set the clocking to run from the PLL.    //    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | 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, "grlib_demo", -1,                         GrContextDpyWidthGet(&g_sContext) / 2, 7, 0);    //    // Draw a vertical sweep of lines from red to green.    //    for(ulIdx = 0; ulIdx <= 10; ulIdx++)    {        GrContextForegroundSet(&g_sContext,                               (((((10 - ulIdx) * 255) / 10) << ClrRedShift) |                                (((ulIdx * 255) / 10) << ClrGreenShift)));        GrLineDraw(&g_sContext, 62, 70, 2, 70 - (5 * ulIdx));    }    //    // Draw a horizontal sweep of lines from green to blue.    //    for(ulIdx = 1; ulIdx <= 10; ulIdx++)    {        GrContextForegroundSet(&g_sContext,                               (((((10 - ulIdx) * 255) / 10) <<                                 ClrGreenShift) |                                (((ulIdx * 255) / 10) << ClrBlueShift)));        GrLineDraw(&g_sContext, 62, 70, 2 + (ulIdx * 6), 20);    }    //    // Draw a filled circle with an overlapping circle.    //    GrContextForegroundSet(&g_sContext, ClrBrown);    GrCircleFill(&g_sContext, 88, 37, 17);    GrContextForegroundSet(&g_sContext, ClrSkyBlue);    GrCircleDraw(&g_sContext, 104, 45, 17);    //    // Draw a filled rectangle with an overlapping rectangle.    //    GrContextForegroundSet(&g_sContext, ClrSlateGray);    sRect.sXMin = 4;    sRect.sYMin = 84;    sRect.sXMax = 42;    sRect.sYMax = 104;    GrRectFill(&g_sContext, &sRect);    GrContextForegroundSet(&g_sContext, ClrSlateBlue);    sRect.sXMin += 12;    sRect.sYMin += 15;    sRect.sXMax += 12;    sRect.sYMax += 15;//.........这里部分代码省略.........
开发者ID:fejerson108,项目名称:Stellarisware,代码行数:101,


示例23: AcquireRun

int AcquireRun(void){    if(g_ulADCCount != ulLastADCCount)    {    	ulLastADCCount=g_ulADCCount;        if(ind2 <0)        ind2=ind2+buffer_size;        else        ind2=ind2%buffer_size;        buffer[0][ind2]=(unsigned long)(g_ulADCData[0]&0xfff);        //max1=max1+buffer[0][ind2];        buffer[1][ind2]=(unsigned long)g_ulADCData[1];        //prev_index=ind2;        ind2++;        rcount++;        compute_sum1(0);        if(rcount%buffer_increment==0)        {        	compute_sum1(1);        }        rem=rcount%((int)PULSE_SAMPLE);    	if(rem==0)    	{    	    mode1=(mode1+1)%2;    	    if(mode1==0)    	    	led_on();    	    else    	    	led_off();    	    int angle=0;    	    if(max2>0 && max1>0 && abs(maxi1-maxi2)<PULSE_SAMPLE)    	    {    	    angle=abs(maxi1-maxi2);    	    }    	    acount++;    	    max1=max1*20.0/4095;    	    max2=max2*20.0/4095;    	    //max1=max1/(2*buffer_increment);    		snprintf(text,sizeof(text),"%ld,%ld",max1,max2);    	    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,FILTER_SAMPLE);    	    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;    	    buffer_index=0;    	}    }//.........这里部分代码省略.........
开发者ID:pi19404,项目名称:Embedded,代码行数:101,


示例24: 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:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,


示例25: ShowStatusScreen

//*****************************************************************************//// This function shows a status screen.  It draws a banner at the top of the// screen with the name of the application, and then up to 5 lines of text// in the remaining screen area.  The caller specifies a pointer to a set of// strings, and the count of number of lines of text (up to 5).  This// function attempts to vertically center the strings on the display.////*****************************************************************************static voidShowStatusScreen(char *pcStatus[], uint32_t ui32Count){    tContext sContext;    tRectangle sRect;    uint32_t ui32Idx;    int32_t i32Y;    //    // 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);    //    // Fill the rest of the display with black, to clear whatever was there    // before.    //    sRect.i16YMin = 10;    sRect.i16YMax = 63;    GrContextForegroundSet(&sContext, ClrBlack);    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-host-msc", -1,                         GrContextDpyWidthGet(&sContext) / 2, 4, 0);    //    // Cap the max number of status lines to 5    //    ui32Count = (ui32Count > 5) ? 5 : ui32Count;    //    // Compute the starting Y coordinate based on the number of lines.    //    i32Y = 40 - (ui32Count * 5);    //    // Display the status lines    //    for(ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++)    {        GrStringDrawCentered(&sContext, pcStatus[ui32Idx], -1,                             GrContextDpyWidthGet(&sContext) / 2, i32Y, 0);        i32Y += 10;    }}
开发者ID:RoboEvangelist,项目名称:TivaWare_C_Series-2.1.0.12573,代码行数:73,


示例26: MouseCallback

//.........这里部分代码省略.........            //            g_ui32Buttons |= ui32MsgParam;            break;        }        //        // Mouse button release detected.        //        case USBH_EVENT_HID_MS_REL:        {            //            // Remove the button from the pressed state.            //            g_ui32Buttons &= ~ui32MsgParam;            break;        }        //        // Mouse X movement detected.        //        case USBH_EVENT_HID_MS_X:        {            //            // Update the cursor X position.            //            g_i32CursorX += (int8_t)ui32MsgParam;            //            // Cap the value to not cause an overflow.            //            if(g_i32CursorX > 9999)            {                g_i32CursorX = 9999;            }            if(g_i32CursorX < -9999)            {                g_i32CursorX = -9999;            }            break;        }        //        // Mouse Y movement detected.        //        case USBH_EVENT_HID_MS_Y:        {            //            // Update the cursor Y position.            //            g_i32CursorY += (int8_t)ui32MsgParam;            //            // Cap the value to not cause an overflow.            //            if(g_i32CursorY > 9999)            {                g_i32CursorY = 9999;            }            if(g_i32CursorY < -9999)            {                g_i32CursorY = -9999;            }            break;        }        default:        {            //            // No reason to update.            //            i32DoUpdate = 0;            break;        }    }    //    // Display the current mouse position and button state if there was an    // update.    //    if(i32DoUpdate)    {        GrStringDrawCentered(&g_sContext, "Position:", -1,                                 GrContextDpyWidthGet(&g_sContext) / 2, 16, 0);        usprintf(pcBuffer, "   %d,%d   ", g_i32CursorX, g_i32CursorY);        GrStringDrawCentered(&g_sContext, pcBuffer, -1,                                 GrContextDpyWidthGet(&g_sContext) / 2, 26, 1);        GrStringDrawCentered(&g_sContext, "Buttons:", -1,                                 GrContextDpyWidthGet(&g_sContext) / 2, 36, 0);        usprintf(pcBuffer, "%d%d%d", g_ui32Buttons & 1, (g_ui32Buttons & 2) >> 1,                 (g_ui32Buttons & 4) >> 2);        GrStringDrawCentered(&g_sContext, pcBuffer, -1,                                 GrContextDpyWidthGet(&g_sContext) / 2, 46, 1);    }}
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,


示例27: DrawStringWrapped

//*****************************************************************************//// Handles wrapping a string within an area.//// /param psContext is the context of the area to update.// /param pcString is the string to print out.// /param i32LineHeight is the height of a character in the currrent font.// /param i32X is the x position to start printing this string.// /param i32Y is the y position to start printing this string.// /param bSplitOnSpace is true if strings in the current language must be// split only on space characters or false if they may be split between any// two characters.//// /return Returns the number of lines that were printed due to this string.////*****************************************************************************uint32_tDrawStringWrapped(tContext *psContext, char *pcString,                  int32_t i32LineHeight, int32_t i32X, int32_t i32Y,                  bool bSplitOnSpace){    uint32_t ui32Width, ui32CharWidth, ui32StrWidth, ui32Char;    uint32_t ui32Lines, ui32Skip;    char *pcStart, *pcEnd;    char *pcLastSpace;    ui32Lines = 0;    //    // Get the number of pixels we have to fit the string into across the    // screen.    //    ui32Width = GrContextDpyWidthGet(psContext) - 16 - i32X;    //    // Get a pointer to the terminating zero.    //    pcEnd = pcString;    while(*pcEnd)    {        pcEnd++;    }    //    // The first substring we draw will start at the beginning of the string.    //    pcStart = pcString;    pcLastSpace = pcString;    ui32StrWidth = 0;    //    // Keep processing until we have no more characters to display.    //    do    {        //        // Get the next character in the string.        //        ui32Char = GrStringNextCharGet(psContext, pcString,                                       (pcEnd - pcString), &ui32Skip);        //        // Did we reach the end of the string?        //        if(ui32Char)        {            //            // No - how wide is this character?            //            ui32CharWidth = GrStringWidthGet(psContext, pcString, ui32Skip);            //            // Have we run off the edge of the display?            //            if((ui32StrWidth + ui32CharWidth) > ui32Width)            {                //                // If we are splitting on spaces, rewind the string pointer to                // the byte after the last space.                //                if(bSplitOnSpace)                {                    pcString = pcLastSpace;                }                //                // Yes - draw the substring.                //                GrStringDraw(psContext, pcStart, (pcString - pcStart),                             i32X, i32Y, 0);                //                // Increment the line count and move the y position down by the                // current font's line height.                //                ui32Lines++;                i32Y += i32LineHeight;                ui32StrWidth = 0;                ////.........这里部分代码省略.........
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,


示例28: 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:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,


示例29: main

//.........这里部分代码省略.........    //    USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER);    //    // Tell the USB library the CPU clock and the PLL frequency.    //    USBOTGFeatureSet(0, USBLIB_FEATURE_CPUCLK, &ui32SysClock);    USBOTGFeatureSet(0, USBLIB_FEATURE_USBPLL, &ui32PLLRate);    //    // Initialize the USB controller for Host mode.    //    USBHCDInit(0, g_pui8HCDPool, sizeof(g_pui8HCDPool));    //    // 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-hub");    //    // 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)))/                           GrFontHeightGet(g_psFontFixed6x8);    //    // Initial update of the screen.    //    UpdateStatus(0);    UpdateStatus(1);    UpdateStatus(2);    UpdateStatus(3);    g_ui32CmdIdx = 0;    g_ui32CurrentLine = 0;    //    // Initialize the file system.    //    FileInit();    //    // The main loop for the application.    //    while(1)    {
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:67,


示例30: main

//*****************************************************************************//// This is the main loop that runs the application.////*****************************************************************************intmain(void){    tRectangle sRect;    //    // Set the clocking to run directly from the crystal.    //    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |                       SYSCTL_XTAL_16MHZ);    //    // Set the device pinout appropriately for this board.    //    PinoutSet();#ifdef DEBUG    //    // Open UART0 for debug output.    //    UARTStdioInit(0);#endif    //    // Set the system tick to fire 100 times per second.    //    ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);    ROM_SysTickIntEnable();    ROM_SysTickEnable();    //    // Initialize the display driver.    //    Kitronix320x240x16_SSD2119Init();    //    // Initialize the graphics context.    //    GrContextInit(&g_sContext, &g_sKitronix320x240x16_SSD2119);    //    // 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) - 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_pFontCm20);    GrStringDrawCentered(&g_sContext, "boot-demo-usb", -1,                         GrContextDpyWidthGet(&g_sContext) / 2, 10, 0);    //    // Draw the buttons in their initial (unpressed)state.    //    UpdateDisplay(g_ucButtons, true);    //    // Initialize each of the device instances that will form our composite    // USB device.    //    g_sCompDevice.psDevices[0].pvInstance =        USBDHIDMouseCompositeInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice);    g_sCompDevice.psDevices[1].pvInstance =        USBDDFUCompositeInit(0, (tUSBDDFUDevice *)&g_sDFUDevice);    //    // Pass the USB library our device information, initialize the USB    // controller and connect the device to the bus.    //    USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_BUFFER_SIZE,                      g_pcDescriptorBuffer);    //    // Initialize the touch screen driver.    //    TouchScreenInit();    //    // Set the touch screen event handler.    //    TouchScreenCallbackSet(MouseTouchHandler);    ////.........这里部分代码省略.........
开发者ID:yangjunjiao,项目名称:Luminary-Micro-Library,代码行数:101,



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


C++ GrContextFontSet函数代码示例
C++ GrContextDpyHeightGet函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。