ButterflyMP3
|
00001 00034 #ifndef PCD8544_H 00035 #define PCD8544_H 00036 00037 #include <avr/io.h> 00038 #include <avr/pgmspace.h> 00039 #include <avr/interrupt.h> 00040 #include "types.h" 00041 00042 00043 /*** LCD defines ************************************************************** 00044 * 00045 * These are the port/pins I used; change if necessary them to suit your 00046 * circuit. 00047 * 00048 **************************************************************************///{ 00049 00050 00051 // for AVR Butterfly 00052 //#define NOKIA_ALTPINOUT 00053 #ifdef NOKIA_ALTPINOUT 00054 #define lcdPort PORTC // port that LCD is on; needs 5 free pins 00055 #define lcdPortD DDRC // 00056 #define SCLK PC3 00057 #define SDIN PC2 00058 #define DC PC7 00059 #define SCE_ PC6 00060 #define RES_ PC4 00061 #else 00062 #define lcdPort PORTC // port that LCD is on; needs 5 free pins 00063 #define lcdPortD DDRC // 00064 #define SCLK PC3 00065 #define SDIN PC5 00066 #define DC PC2 00067 #define SCE_ PC1 00068 #define RES_ PC4 00069 #endif 00070 00071 // LCD Defines 00072 //#define LOwERCASE_STRINGS 00073 00074 /*** LCD Simple Controls ****************************************************** 00075 * 00076 * Some low level LCD controls 00077 * 00078 **************************************************************************///{ 00079 #define lcdInvert1 lcdModeCmd;lcdByte(0x0d) // invert 00080 #define lcdInvert0 lcdModeCmd;lcdByte(0x0c) // normal 00081 00082 #define lcdModeCmd lcdPort &= (unsigned char)~_BV(DC) 00083 #define lcdModeData lcdPort |= (unsigned char)_BV(DC) 00084 00085 #define lcdResume lcdPort &= (unsigned char)~_BV(SCE_) 00086 #define lcdSuspend lcdPort |= (unsigned char)_BV(SCE_) 00087 00088 #define lcdReset lcdPort &= (unsigned char)~_BV(RES_);lcdPort |= (unsigned char) _BV(RES_) // reset the LCD 00089 //} 00090 // LCD Simple Controls 00091 00092 /*** LCD Size ***************************************************************** 00093 * 00094 * Used mainly during testing on an 8515/stk500. The 8515 has 512 bytes RAM, 00095 * and the frame buffer is 6x84=504 bytes leaving too little (8b) for other 00096 * stuff. My solution was to decrease the vertical lines available (temporarily 00097 * of course) to let me use 5x84=420 bytes, and have enough for other stuff. 00098 * 00099 * If you are using a processor with less than 1K of RAM, you can decrease the 00100 * 'fbRows' value to 5. You can draw to the last LCD row without the frame 00101 * buffer by calling "lcdXY(x,5)" (where 'x' is 0 to 84) and then writing a 00102 * byte by calling "lcdByte(value)" to fill in one column at a time. 00103 * 00104 **************************************************************************///{ 00105 #define fbCols 84 00106 #define fbRows 2 00107 //} 00108 // LCD Size 00109 00110 /*** Global Vars ************************************************************** 00111 * 00112 * Just the framebuffer and frame buffer cursor 00113 * 00114 **************************************************************************///{ 00115 // uint8 frameBuffer[fbCols][fbRows]; // __attribute__ ((section (".noinit"))); 00116 uint8 fbXY[2]; // frame buffer cursor location 00117 //} 00118 // Global Variables 00119 00120 00121 /*** LCD Functions ********************************************************* 00122 * 00123 * User functions for manipulating the LCD. 00124 * 00125 ***************************************************************************/ 00126 void lcdByte(uint8 data); 00127 void lcdDot(uint8 x, uint8 yLine, uint8 color); 00128 void lcdCh(uint8* fontSet, uint8 ch); 00129 void lcdWrite(uint8* fontSet, uint8* buf, uint8 is_pstr, uint8 len); 00130 void fbClr(void); 00131 void lcdClr(void); 00132 void lcdClrLine(uint8 lineNo); 00133 void lcdInit(void); 00134 void lcdXY(uint8 x, uint8 y); 00135 00136 //void lcdLine ( uint8 x1, uint8 y1, uint8 x2, uint8 y2, uint8 mode ); 00137 00138 //} LCD Functions 00139 #endif