Appendix b: example driver code, Symbol and variable declarations – Digilent 410-216P-KIT User Manual
Page 9

chipKIT Basic I/O Shield Reference Manual
www.digilentinc.com
page 9 of 15
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 to initialize the display controller and write 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];