1

我正在使用 Cortex M3、Stellaris® LM3S6965 评估板。我正在尝试在正在工作的 oled 屏幕上显示文本。但我不知道如何增加文本大小。

有人知道该怎么做吗?

我当前的代码:

    #include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/sysctl.h"
#include "drivers/rit128x96x4.h"


//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, unsigned long ulLine)
{
}
#endif

//*****************************************************************************
//
// Display scrolling text plus graphics on the OLED display.
//
//*****************************************************************************
int
main(void)
{
    unsigned long ulRow, ulCol, ulWidth, ulHeight;
    volatile int iDelay;
    unsigned char *pucRow;
    static char pucHello[] =
    {
        "                      "
        "Current selected timezone: +2 GMT - Brussels"
        "                      "
    };

    //
    // Set the clocking to run directly from the crystal.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    //
    // Initialize the OLED display.
    //
    RIT128x96x4Init(1000000);

    // Simple scrolling text display
    //
    ulCol = 0;
    while(1)
    {
        //
        // Display the text.
        //
        RIT128x96x4StringDraw(&pucHello[ulCol++], 8, 8, 11);

        //
        // Delay for a bit.
        //
        for(iDelay = 0; iDelay < 100000; iDelay++)
        {
        }

        //
        // Wrap the index back to the beginning of the string.
        //
        if(ulCol > 53)
        {
            ulCol = 0;
        }
    }
}
4

3 回答 3

2

当然,不能保证你可以。

嵌入式系统在字体使用方面通常没有太大的自由度。动态缩放非常昂贵,并且许多字体是作为特定大小的预渲染二进制位图的句柄。

您需要查看rit128x96x4.h标头定义的 API:s,因为这似乎是特定于显示的功能。

您没有说您当前获得的字体有多大;在小至 128x96 的显示器上,我不希望有任何超大字体,因为通常提供小字体以最大化屏幕上可以容纳的文本量会更有用。

更新:如果这个随机的谷歌命中是准确的,提供的图形 API 并不完全丰富,而且似乎没有办法切换字体。

于 2013-01-03T08:56:55.113 回答
2

StellarisWare 下的 grlib\fonts 文件夹中有一个字体编号。您可以使用 API 调用 GrContextFontSet() 更改字体

于 2013-01-03T17:18:28.293 回答
1

字体通常只是位图数组。您可以为您想要的任何字体重新定义位图。如果要增加大小,则可能还需要更改其他常量,以便绘图例程知道如何在渲染字符时对其进行间隔。

于 2013-01-03T14:13:24.880 回答