Datasheet

chipKITBasic I/O ShieldReference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Appendix B: Example Driver Code
The following gives an example of code that initializes the display controller and writes the contents of a memory
buffer into the display. This example is written for the chipKIT Uno32 board.
Symbol and Variable Declarations
/* ------------------------------------------------------------ */
/* Pin definitions for access to OLED control signals on chipKIT Uno32
*/
#define prtVddCtrl IOPORT_F
#define prtVbatCtrl IOPORT_F
#define prtDataCmd IOPORT_F
#define prtReset IOPORT_G
#define bitVddCtrl BIT_6
#define bitVbatCtrl BIT_5
#define bitDataCmd BIT_4
#define bitReset BIT_9
/* ------------------------------------------------------------ */
/* Symbols describing the geometry of the display.
#define cbOledDispMax 512 //max number of bytes in display buffer
#define ccolOledMax 128 //number of display columns
#define crowOledMax 32 //number of display rows
#define cpagOledMax 4 //number of display memory pages
/* ------------------------------------------------------------ */
/* This array is the off-screen frame buffer used for rendering.
** It isn't possible to read back from the OLED display device,
** so display data is rendered into this off-screen buffer and then
** copied to the display.
*/
BYTE rgbOledBmp[cbOledDispMax];
PIC32 Hardware Initialization
The following function initializes the PIC32 hardware for talking to the display. It initializes the SPI controller and
sets the control pins to be outputs.
/* ------------------------------------------------------------ */
/*** OledHostInit
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Perform PIC32 device initialization to prepare for use
** of the OLED display.
** This example is hard coded for the chipKIT Uno32 and
** SPI2.
*/