driver for 8x8
8x8.cpp
- Committer:
- cstevens
- Date:
- 2016-06-14
- Revision:
- 0:12e8e6371165
File content as of revision 0:12e8e6371165:
#include "8x8.h" #include "smiles.h" //define 2 buses for the row and column pins BusOut Row(PTC11,PTC10,PTC3,PTB10,PTC0,PTE2,PTE3,PTC5); BusOut Col(PTC7,PTC6,PTB8,PTC4,PTE5,PTB9,PTE4,PTB11); // sub to write character to the 8x8 display once - has to be repeated to keep display live int write_8x8(int eye,int mth) { int rw,i; //write eyes for(i=0; i<4; i++) { rw=0; rw=1<<i; Row=~rw; // this inverts the row code so that only the desired row is low Col=eyes[i+4*eye]; wait(0.002); }//endfori //write mouth for(i=4; i<8; i++) { rw=0; rw=1<<i; Row=~rw; // this inverts the row code so that only the desired row is low Col=mouth[i-4+4*mth]; wait(0.002); }//endfori return(0); }