Datasheet
Memory LCD Programming
LCD Application Note 5
////////////////////////////////////////////////////////////////
//
// This routine transmits the contents of the pixel memory in
// a frame buffer to the memory LCD. It uses DMA to transfer
// each individual line. The address of the frame buffer to
// transfer is in the global variable show_frm.
//
// NOTE: this routine also acts as the interrupt handler for SPI
// interrupts.
//
// INPUTS:
// The SPI and DMA units must have been previously initialized
// show_frm: pointer to the buffer to be displayed
//
////////////////////////////////////////////////////////////////
void show_frame(char *show_frm) {
int i;
unsigned long sts;
switch(stage) {
case 0: // stage 0: sending the first line. The command is
// included in this line
set_scs(HIGH); //set SCS high
frmbufptr = show_frm; //init pointer to frame buffer
linebuf = locbuf; //init pointer to line buffer
linenum = 1; //init line address
//first line of data is preceeded by a write command
*linebuf++ = MLCD_WR | vcom; //command (note: no need to swap)
*linebuf++ = swap(linenum++); //line number (address)
for(i= 0; i < MLCD_BYTES_LINE; i++) *linebuf++ =
swap(*frmbufptr++); //swap the order of the bits
*linebuf++ = 0; //trailer
//Setup the SPI DMA controller (starting addr, size)
TransferSetup(locbuf, linebuf - locbuf);
//Start the xfer
TransferStart;
stage = 1; //set to next stage
break;