FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/osram128x64x4.c
//*****************************************************************************
//
//! Displays a string on the OLED display.
//!
//! \param pcStr is a pointer to the string to display.
//! \param ulX is the horizontal position to display the string, specified in
//! columns from the left edge of the display.
//! \param ulY is the vertical position to display the string, specified in
//! rows from the top edge of the display.
//! \param ucLevel is the 4-bit grey scale value to be used for displayed text.
//!
//! This function will draw a string on the display.  Only the ASCII characters
//! between 32 (space) and 126 (tilde) are supported; other characters will
//! result in random data being draw on the display (based on whatever appears
//! before/after the font in memory).  The font is mono-spaced, so characters
//! such as "i" and "l" have more white space around them than characters such
//! as "m" or "w".
//!
//! If the drawing of the string reaches the right edge of the display, no more
//! characters will be drawn.  Therefore, special care is not required to avoid
//! supplying a string that is "too long" to display.
//!
//! This function is contained in <tt>osram128x64x4.c</tt>, with
//! <tt>osram128x64x4.h</tt> containing the API definition for use by
//! applications.
//!
//! \note Because the OLED display packs 2 pixels of data in a single byte, the
//! parameter \e ulX must be an even column number (e.g. 0, 2, 4, etc).
//!
//! \return None.
//
//*****************************************************************************
Displays a string on the OLED display.
\param pcStr is a pointer to the string to display.
\param ulX is the horizontal position to display the string, specified in
columns from the left edge of the display.
\param ulY is the vertical position to display the string, specified in
rows from the top edge of the display.
\param ucLevel is the 4-bit grey scale value to be used for displayed text.

This function will draw a string on the display.  Only the ASCII characters
between 32 (space) and 126 (tilde) are supported; other characters will
result in random data being draw on the display (based on whatever appears
before/after the font in memory).

If the drawing of the string reaches the right edge of the display, no more
characters will be drawn.  Therefore, special care is not required to avoid
supplying a string that is "too long" to display.

This function is contained in osram128x64x4.c, with
osram128x64x4.h containing the API definition for use by
applications.

\note Because the OLED display packs 2 pixels of data in a single byte, the
parameter \e ulX must be an even column number .

\return None.
Displays a string on the OLED display . \ param pcStr is a pointer to the string to display . \ param ulX is the horizontal position to display the string specified in columns from the left edge of the display . \ param ulY is the vertical position to display the string specified in rows from the top edge of the display . \ param ucLevel is the 4 - bit grey scale value to be used for displayed text . This function will draw a string on the display . Only the ASCII characters between 32 ( space ) and 126 ( tilde ) are supported ; other characters will result in random data being draw on the display ( based on whatever appears before / after the font in memory ) . If the drawing of the string reaches the right edge of the display no more characters will be drawn . Therefore special care is not required to avoid supplying a string that is " too long " to display . This function is contained in osram128x64x4 . c with osram128x64x4 . h containing the API definition for use by applications . \ note Because the OLED display packs 2 pixels of data in a single byte the parameter \ e ulX must be an even column number . \ return None .
void
OSRAM128x64x4StringDraw(const char *pcStr, unsigned long ulX,
                        unsigned long ulY, unsigned char ucLevel)
{
    static unsigned char pucBuffer[8];
    unsigned long ulIdx1, ulIdx2;
    unsigned char ucTemp;
     Check the arguments.
    ASSERT(ulX < 128);
    ASSERT((ulX & 1) == 0);
    ASSERT(ulY < 64);
    ASSERT(ucLevel < 16);
     Setup a window starting at the specified column and row, ending
     at the right edge of the display and 8 rows down (single character row).
    pucBuffer[0] = 0x15;
    pucBuffer[1] = ulX / 2;
    pucBuffer[2] = 63;
    OSRAMWriteCommand(pucBuffer, 3);
    pucBuffer[0] = 0x75;
    pucBuffer[1] = ulY;
    pucBuffer[2] = ulY + 7;
    OSRAMWriteCommand(pucBuffer, 3);
    OSRAMWriteCommand(g_pucOSRAM128x64x4VerticalInc,
                      sizeof(g_pucOSRAM128x64x4VerticalInc));
     Loop while there are more characters in the string.
    while(*pcStr != 0)
    {
         Get a working copy of the current character and convert to an
         index into the character bit-map array.
        ucTemp = *pcStr;
        ucTemp &= 0x7F;
        if(ucTemp < ' ')
        {
            ucTemp = ' ';
        }
        else
        {
            ucTemp -= ' ';
        }
         Build and display the character buffer.
        for(ulIdx1 = 0; ulIdx1 < 3; ulIdx1++)
        {
             Convert two columns of 1-bit font data into a single data
             byte column of 4-bit font data.
            for(ulIdx2 = 0; ulIdx2 < 8; ulIdx2++)
            {
                pucBuffer[ulIdx2] = 0;
                if(g_pucFont[ucTemp][ulIdx1*2] & (1 << ulIdx2))
                {
                    pucBuffer[ulIdx2] = ((ucLevel << 4) & 0xf0);
                }
                if((ulIdx1 < 2) &&
                    (g_pucFont[ucTemp][ulIdx1*2+1] & (1 << ulIdx2)))
                {
                    pucBuffer[ulIdx2] |= ((ucLevel << 0) & 0x0f);
                }
            }
             If there is room, dump the single data byte column to the
             display.  Otherwise, bail out.
            if(ulX < 126)
            {
                OSRAMWriteData(pucBuffer, 8);
                ulX += 2;
            }
            else
            {
                return;
            }
        }
         Advance to the next character.
        pcStr++;
    }
}
void OSRAM128x64x4StringDraw ( const char * pcStr , unsigned long ulX , unsigned long ulY , unsigned char ucLevel ) { static unsigned char pucBuffer [ 8 ] ; unsigned long ulIdx1 , ulIdx2 ; unsigned char ucTemp ; ASSERT ( ulX < 128 ) ; ASSERT ( ( ulX & 1 ) == 0 ) ; ASSERT ( ulY < 64 ) ; ASSERT ( ucLevel < 16 ) ; pucBuffer [ 0 ] = 0x15 ; pucBuffer [ 1 ] = ulX / 2 ; pucBuffer [ 2 ] = 63 ; OSRAMWriteCommand ( pucBuffer , 3 ) ; pucBuffer [ 0 ] = 0x75 ; pucBuffer [ 1 ] = ulY ; pucBuffer [ 2 ] = ulY + 7 ; OSRAMWriteCommand ( pucBuffer , 3 ) ; OSRAMWriteCommand ( g_pucOSRAM128x64x4VerticalInc , sizeof ( g_pucOSRAM128x64x4VerticalInc ) ) ; while ( * pcStr != 0 ) { ucTemp = * pcStr ; ucTemp &= 0x7F ; if ( ucTemp < ' ' ) { ucTemp = ' ' ; } else { ucTemp -= ' ' ; } for ( ulIdx1 = 0 ; ulIdx1 < 3 ; ulIdx1 ++ ) { for ( ulIdx2 = 0 ; ulIdx2 < 8 ; ulIdx2 ++ ) { pucBuffer [ ulIdx2 ] = 0 ; if ( g_pucFont [ ucTemp ] [ ulIdx1 * 2 ] & ( 1 << ulIdx2 ) ) { pucBuffer [ ulIdx2 ] = ( ( ucLevel << 4 ) & 0xf0 ) ; } if ( ( ulIdx1 < 2 ) && ( g_pucFont [ ucTemp ] [ ulIdx1 * 2 + 1 ] & ( 1 << ulIdx2 ) ) ) { pucBuffer [ ulIdx2 ] |= ( ( ucLevel << 0 ) & 0x0f ) ; } } if ( ulX < 126 ) { OSRAMWriteData ( pucBuffer , 8 ) ; ulX += 2 ; } else { return ; } } pcStr ++ ; } }
Displays a string on the OLED display.
Displays a string on the OLED display .
// // Check the arguments. // // // Setup a window starting at the specified column and row, ending // at the right edge of the display and 8 rows down (single character row). // // // Loop while there are more characters in the string. // // // Get a working copy of the current character and convert to an // index into the character bit-map array. // // // Build and display the character buffer. // // // Convert two columns of 1-bit font data into a single data // byte column of 4-bit font data. // // // If there is room, dump the single data byte column to the // display.  Otherwise, bail out. // // // Advance to the next character. //