Search code examples
ctextcortex-m

Increase text size on oled (Cortex M3, Stellaris LM3S6965)


I'm working with Cortex M3, Stellaris® LM3S6965 Evaluation Board. I'm trying to display text on the oled screen which is working. But I don't know how to increase the text size.

Does anybody know how to do that?

My current code:

    #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;
        }
    }
}

Solution

  • There's no guarantee that you can, of course.

    Embedded systems typically don't have very much freedom when it comes to font usage; dynamic scaling is pretty expensive and many fonts are handles as pre-rendered binary bitmaps of a specific size.

    You need to look in the API:s defined by the rit128x96x4.h header, since that seems to be the display-specific functionality.

    You don't say how large the font you're currently getting is; on a display as small as 128x96, I wouldn't expect there to be any super-large fonts since in general it would be more useful to provide a small font to maximize the amount of text you can fit on the screen.

    UPDATE: If this random Google hit is accurate, the graphics API provided is not exactly rich, and there seems to be no way of switching fonts.