Digilent chipKIT Basic I/O Shield Manual de referência - Página 9
Procurar online ou descarregar pdf Manual de referência para Sistemas de E/S Digilent chipKIT Basic I/O Shield. Digilent chipKIT Basic I/O Shield 14 páginas.
chipKIT™ Basic I/O Shield™ Reference Manual
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
#define
prtVbatCtrl
#define
prtDataCmd
#define
prtReset
#define
bitVddCtrl
#define
bitVbatCtrl
#define
bitDataCmd
#define
bitReset
/* ------------------------------------------------------------ */
/* Symbols describing the geometry of the display.
#define
cbOledDispMax
#define
ccolOledMax
#define
crowOledMax
#define
cpagOledMax
/* ------------------------------------------------------------ */
/* 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.
*/
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
IOPORT_F
IOPORT_F
IOPORT_F
IOPORT_G
BIT_6
BIT_5
BIT_4
BIT_9
512
//max number of bytes in display buffer
128
//number of display columns
32
//number of display rows
4
//number of display memory pages
Page 9 of 13