beautypg.com

Digilent 410-216P-KIT User Manual

Page 13

background image

chipKIT Basic I/O Shield Reference Manual

www.digilentinc.com

page 13 of 15

Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.

Display Memory Update


This function copies the contents of a 512 byte buffer from PIC32 memory to the display. The display
memory is organized as four pages of 128 bytes each. Each memory page corresponds to an eight
pixel high stripe across the display. Each byte in the memory page corresponds to an eight pixel high
column on the display. The least significant bit in a display byte is the top most pixel, and the most
significant bit the bottom most pixel. The first byte in the page corresponds to the left most pixels on
the display and the last byte the right most pixels.

This function assumes that the display buffer to be copied is the global variable

rgbOledBmp

/* ------------------------------------------------------------ */
/*** OledUpdate
**
**

Parameters:

**

none

**
**

Return Value:

**

none

**
**

Errors:

**

none

**
**

Description:

**

Update the OLED display with the contents of the memory buffer

*/

void
OledUpdate()

{

int

ipag;

int

icol;

BYTE *

pb;


pb = rgbOledBmp;


for (ipag = 0; ipag < cpagOledMax; ipag++) {


PORTClearBits(prtDataCmd, bitDataCmd);


/* Set the page address

*/

Spi2PutByte(0x22);

//Set page command

Spi2PutByte(ipag);

//page number


/* Start at the left column

*/

Spi2PutByte(0x00);

//set low nybble of column

Spi2PutByte(0x10);

//set high nybble of column


PORTSetBits(prtDataCmd, bitDataCmd);


/* Copy this memory page of display data.

*/

OledPutBuffer(ccolOledMax, pb);

pb += ccolOledMax;


}


}