本文整理汇总了C++中RITWriteCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ RITWriteCommand函数的具体用法?C++ RITWriteCommand怎么用?C++ RITWriteCommand使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RITWriteCommand函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OLED_ImageDraw
//OLED绘制图形
void OLED_ImageDraw(unsigned char *pucImage, unsigned long ulX,
unsigned long ulY, unsigned long ulWidth,
unsigned long ulHeight)
{
//
// Check the arguments.
//
ASSERT(ulX < 128);
ASSERT((ulX & 1) == 0);
ASSERT(ulY < 96);
ASSERT((ulX + ulWidth) <= 128);
ASSERT((ulY + ulHeight) <= 96);
ASSERT((ulWidth & 1) == 0);
//
// Setup a window starting at the specified column and row, and ending
// at the column + width and row+height.
//发送左右范围
g_pucBuffer[0] = 0x15;
g_pucBuffer[1] = ulX / 2;
g_pucBuffer[2] = (ulX + ulWidth - 2) / 2;
RITWriteCommand(g_pucBuffer, 3);
//发送上下范围
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = ulY;
g_pucBuffer[2] = ulY + ulHeight - 1;
RITWriteCommand(g_pucBuffer, 3);
//设置为上下递增
RITWriteCommand(g_pucRIT128x96x4HorizontalInc,
sizeof(g_pucRIT128x96x4HorizontalInc));
//
// Loop while there are more rows to display.
//
while(ulHeight--)
{
//
// Write this row of image data.
//
RITWriteData(pucImage, (ulWidth / 2));
//
// Advance to the next row of the image.
//
pucImage += (ulWidth / 2);
}
}
示例2: OLED_Xplot
extern void OLED_Xplot(unsigned char *putLine)
{
unsigned long i;
unsigned char a[]={0xff},b[]={0xf0},c[]={0x0f};
for(i=0;i<128;i+=2)
{
if(putLine[i]==putLine[i+1])
{
g_pucBuffer[0]=0x15;
g_pucBuffer[1]=i/2;
g_pucBuffer[2]=1;
RITWriteCommand(g_pucBuffer, 3);
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = test[i];
g_pucBuffer[2] = 1;
RITWriteCommand(g_pucBuffer, 3);
RITWriteCommand(g_pucRIT128x96x4HorizontalInc,
sizeof(g_pucRIT128x96x4HorizontalInc));
RITWriteData(a,1);
}
else
{
g_pucBuffer[0]=0x15;
g_pucBuffer[1]=(int)(i/2);
g_pucBuffer[2]=1;
RITWriteCommand(g_pucBuffer, 3);
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = test[i];
g_pucBuffer[2] = 1;
RITWriteCommand(g_pucBuffer, 3);
RITWriteCommand(g_pucRIT128x96x4HorizontalInc,
sizeof(g_pucRIT128x96x4HorizontalInc));
RITWriteData(b,1);
g_pucBuffer[0]=0x15;
g_pucBuffer[1]=(int)(i/2);
g_pucBuffer[2]=1;
RITWriteCommand(g_pucBuffer, 3);
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = test[i+1];
g_pucBuffer[2] = 1;
RITWriteCommand(g_pucBuffer, 3);
RITWriteCommand(g_pucRIT128x96x4HorizontalInc,
sizeof(g_pucRIT128x96x4HorizontalInc));
RITWriteData(c,1);
}
}
}
示例3: OLED_DisplayOff
//! Turns off the OLED display.
//OLED休眠
void OLED_DisplayOff(void)
{
static const unsigned char OLED_SLEEP_CHAR[] =
{
0xAE,0xE3 //0xAE:打开睡眠模式,0xE3:不进行任何操作
};
RITWriteCommand(OLED_SLEEP_CHAR, sizeof(OLED_SLEEP_CHAR));
}
示例4: RIT128x96x4Init
//*****************************************************************************
//
//! Initialize the OLED display.
//!
//! \param ulFrequency specifies the SSI Clock Frequency to be used.
//!
//! This function initializes the SSI interface to the OLED display and
//! configures the SSD1329 controller on the panel.
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4Init(unsigned long ulFrequency)
{
unsigned long ulIdx;
// Initialize the semaphore
OS_InitSemaphore(&oLEDFree, 1);
//
// Enable the SSI0 and GPIO port blocks as they are needed by this driver.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIO_OLEDDC);
//
// Configure the SSI0CLK and SSIOTX pins for SSI operation.
//
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5,
GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO port pin used as a D/Cn signal for OLED device,
// and the port pin used to enable power to the OLED panel.
//
GPIOPinTypeGPIOOutput(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN);
GPIOPadConfigSet(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN,
GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
GPIOPinWrite(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN,
GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN);
HWREGBITW(&g_ulSSIFlags, FLAG_DC_HIGH) = 1;
//
// Configure and enable the SSI0 port for master mode.
//
RIT128x96x4Enable(ulFrequency);
//
// Clear the frame buffer.
//
RIT128x96x4Clear();
//
// Initialize the SSD1329 controller. Loop through the initialization
// sequence array, sending each command "string" to the controller.
//
for(ulIdx = 0; ulIdx < sizeof(g_pucRIT128x96x4Init);
ulIdx += g_pucRIT128x96x4Init[ulIdx] + 1)
{
//
// Send this command.
//
RITWriteCommand(g_pucRIT128x96x4Init + ulIdx + 1,
g_pucRIT128x96x4Init[ulIdx] - 1);
}
}
示例5: RIT128x96x4Clear
//*****************************************************************************
//
//! Clears the OLED display.
//!
//! This function will clear the display RAM. All pixels in the display will
//! be turned off.
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4Clear(void)
{
static const unsigned char pucCommand1[] = { 0x15, 0, 63 };
static const unsigned char pucCommand2[] = { 0x75, 0, 127 };
unsigned long ulRow, ulColumn;
//
// Clear out the buffer used for sending bytes to the display.
//
*(unsigned long *)&g_pucBuffer[0] = 0;
*(unsigned long *)&g_pucBuffer[4] = 0;
//
// Set the window to fill the entire display.
//
RITWriteCommand(pucCommand1, sizeof(pucCommand1));
RITWriteCommand(pucCommand2, sizeof(pucCommand2));
RITWriteCommand(g_pucRIT128x96x4HorizontalInc,
sizeof(g_pucRIT128x96x4HorizontalInc));
//
// Loop through the rows
//
for(ulRow = 0; ulRow < 96; ulRow++)
{
//
// Loop through the columns. Each byte is two pixels,
// and the buffer hold 8 bytes, so 16 pixels are cleared
// at a time.
//
for(ulColumn = 0; ulColumn < 128; ulColumn += 8 * 2)
{
//
// Write 8 clearing bytes to the display, which will
// clear 16 pixels across.
//
RITWriteData(g_pucBuffer, sizeof(g_pucBuffer));
}
}
}
示例6: LCM_WriteByte
void LCM_WriteByte(unsigned char x, unsigned char y, unsigned char bak)
{
unsigned char pucCommand1[3] = { 0x15, 0, 0 };
unsigned char pucCommand2[3] = { 0x75, 0, 0 };
g_pucBuffer[0] = bak;
pucCommand1[1] = x>>1;
pucCommand1[2] = x>>1;
pucCommand2[1] = y;
pucCommand2[2] = y;
// Set the window to fill the entire display.
//
RITWriteCommand(pucCommand1, sizeof(pucCommand1));
RITWriteCommand(pucCommand2, sizeof(pucCommand2));
RITWriteCommand(g_pucRIT128x96x4HorizontalInc,
sizeof(g_pucRIT128x96x4HorizontalInc));
RITWriteData(g_pucBuffer, 1);
}
示例7: RIT128x96x4DisplayOff
//*****************************************************************************
//
//! Turns off the OLED display.
//!
//! This function will turn off the OLED display. This will stop the scanning
//! of the panel and turn off the on-chip DC-DC converter, preventing damage to
//! the panel due to burn-in (it has similar characters to a CRT in this
//! respect).
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4DisplayOff(void)
{
static const unsigned char pucCommand1[] =
{
0xAE, 0xe3
};
//
// Put the display to sleep.
//
RITWriteCommand(pucCommand1, sizeof(pucCommand1));
}
示例8: OLED_DisplayOn
//! Turns on the OLED display.
//打开OLED,显示内部缓存里的数据,发送的命令为OLED_INIT_CMD序列
void OLED_DisplayOn(void)
{
unsigned long ulIdx;
//
// Initialize the SSD1329 controller. Loop through the initialization
// sequence array, sending each command "string" to the controller.
//
for(ulIdx = 0; ulIdx < sizeof(OLED_INIT_CMD);ulIdx += OLED_INIT_CMD[ulIdx] + 1)
{
//
// Send this command.
//
RITWriteCommand(OLED_INIT_CMD + ulIdx + 1,
OLED_INIT_CMD[ulIdx] - 1);
}
}
示例9: RIT128x96x4DisplayOn
//*****************************************************************************
//
//! Turns on the OLED display.
//!
//! This function will turn on the OLED display, causing it to display the
//! contents of its internal frame buffer.
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4DisplayOn(void)
{
unsigned long ulIdx;
//
// Initialize the SSD1329 controller. Loop through the initialization
// sequence array, sending each command "string" to the controller.
//
for(ulIdx = 0; ulIdx < sizeof(g_pucRIT128x96x4Init);
ulIdx += g_pucRIT128x96x4Init[ulIdx] + 1)
{
//
// Send this command.
//
RITWriteCommand(g_pucRIT128x96x4Init + ulIdx + 1,
g_pucRIT128x96x4Init[ulIdx] - 1);
}
}
示例10: RIT128x96x4StringDraw
//*****************************************************************************
//
//! 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 gray 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.
//!
//! \note Because the OLED display packs 2 pixels of data in a single byte, the
//! parameter \e ulX must be an even column number (for example, 0, 2, 4, and
//! so on).
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4StringDraw(const char *pcStr, unsigned long ulX,
unsigned long ulY, unsigned char ucLevel)
{
unsigned long ulIdx1, ulIdx2;
unsigned char ucTemp;
//
// Check the arguments.
//
ASSERT(ulX < 128);
ASSERT((ulX & 1) == 0);
ASSERT(ulY < 96);
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).
//
g_pucBuffer[0] = 0x15;
g_pucBuffer[1] = ulX / 2;
g_pucBuffer[2] = 63;
RITWriteCommand(g_pucBuffer, 3);
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = ulY;
g_pucBuffer[2] = ulY + 7;
RITWriteCommand(g_pucBuffer, 3);
RITWriteCommand(g_pucRIT128x96x4VerticalInc,
sizeof(g_pucRIT128x96x4VerticalInc));
//
// 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++ & 0x7f;
if(ucTemp < ' ')
{
ucTemp = 0;
}
else
{
ucTemp -= ' ';
}
//
// Build and display the character buffer.
//
for(ulIdx1 = 0; ulIdx1 < 6; ulIdx1 += 2)
{
//
// 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++)
{
g_pucBuffer[ulIdx2] = 0;
if(g_pucFont[ucTemp][ulIdx1] & (1 << ulIdx2))
{
g_pucBuffer[ulIdx2] = (ucLevel << 4) & 0xf0;
}
if((ulIdx1 < 4) &&
(g_pucFont[ucTemp][ulIdx1 + 1] & (1 << ulIdx2)))
{
g_pucBuffer[ulIdx2] |= (ucLevel << 0) & 0x0f;
}
}
//.........这里部分代码省略.........
示例11: RIT128x96x4Init
//*****************************************************************************
//
//! Initialize the OLED display.
//!
//! \param ulFrequency specifies the SSI Clock Frequency to be used.
//!
//! This function initializes the SSI interface to the OLED display and
//! configures the SSD1329 controller on the panel.
//!
//! This function is contained in <tt>rit128x96x4.c</tt>, with
//! <tt>rit128x96x4.h</tt> containing the API definition for use by
//! applications.
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4Init(unsigned long ulFrequency)
{
unsigned long ulIdx;
/* Determine which board is being used. */
if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )
{
/* Ethernet is present, we must be using the LM3S8962 EK. */
ulGPIOId = LM3S8962_SYSCTL_PERIPH_GPIO_OLEDDC;
ulGPIOBase = LM3S8962_GPIO_OLEDDC_BASE;
ulOLEDDC_PIN = GPIO_PIN_6;
ulOLEDEN_PIN = GPIO_PIN_7;
}
else
{
/* Ethernet is not present, we must be using the LM3S1968 EK. */
ulGPIOId = LM3S1968_SYSCTL_PERIPH_GPIO_OLEDDC;
ulGPIOBase = LM3S1968_GPIO_OLEDDC_BASE;
ulOLEDDC_PIN = GPIO_PIN_2;
ulOLEDEN_PIN = GPIO_PIN_3;
}
//
// Enable the SSI0 and GPIO port blocks as they are needed by this driver.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(ulGPIOId);
//
// Configure the SSI0CLK and SSIOTX pins for SSI operation.
//
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5,
GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO port pin used as a D/Cn signal for OLED device,
// and the port pin used to enable power to the OLED panel.
//
GPIOPinTypeGPIOOutput(ulGPIOBase, ulOLEDDC_PIN | ulOLEDEN_PIN);
GPIOPadConfigSet(ulGPIOBase, ulOLEDDC_PIN | ulOLEDEN_PIN,
GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
GPIOPinWrite(ulGPIOBase, ulOLEDDC_PIN | ulOLEDEN_PIN,
ulOLEDDC_PIN | ulOLEDEN_PIN);
//
// Configure and enable the SSI0 port for master mode.
//
RIT128x96x4Enable(ulFrequency);
//
// Clear the frame buffer.
//
RIT128x96x4Clear();
//
// Initialize the SSD1329 controller. Loop through the initialization
// sequence array, sending each command "string" to the controller.
//
for(ulIdx = 0; ulIdx < sizeof(g_pucRIT128x96x4Init);
ulIdx += g_pucRIT128x96x4Init[ulIdx] + 1)
{
//
// Send this command.
//
RITWriteCommand(g_pucRIT128x96x4Init + ulIdx + 1,
g_pucRIT128x96x4Init[ulIdx] - 1);
}
}