コード例 #1
0
ファイル: GLCDLowLevel.c プロジェクト: gaezco/LSE
void GLCDLowLevel_SwapBuffer(){


	uint32_t a,b;
	int8_t c,d;
	for (a=0; a<40; a++){

		GLCD_WriteCommand(0x46);
		GLCD_WriteData(RA8835_SAD2L + a);
		GLCD_WriteData(RA8835_SAD2H);
		GLCD_WriteCommand(RA8835_MWRITE);

		for (b=0; b<30; b++){
			for (c=0; c<8; c++){
				for (d=0; d<8; d++){

					if (d-c >= 0){
						GLCDLowLevel_VideoRAM_aux+= (((0x01 << c) & GLCDLowLevel_VideoRAM[(a*8)+(7-d)][b]) << (d-c));
					}
					else {
						GLCDLowLevel_VideoRAM_aux+= (((0x01 << c) & GLCDLowLevel_VideoRAM[(a*8)+(7-d)][b]) >> (c-d));
					}

				}
				GLCD_WriteData(GLCDLowLevel_VideoRAM_aux);
				GLCDLowLevel_VideoRAM_aux=0;

			}

		}

	}
}
コード例 #2
0
ファイル: GLCDLowLevel.c プロジェクト: gaezco/LSE
void GLCD_ClearText(void)
{
int i;
GLCD_TextGoTo(0,0);
GLCD_WriteCommand(RA8835_CSRDIR_R);
GLCD_WriteCommand(RA8835_MWRITE);
for(i = 0; i < 50000; i++)
	GLCD_WriteData(0x00);
GLCD_WriteCommand(RA8835_CSRDIR_D);
}
コード例 #3
0
ファイル: glcd.c プロジェクト: naminic/Grafical-Lcd-Arm
//-----------------------
void SetColumn(unsigned char y){
CurrentColumn = y;
if (y < 64){
	GLCD_WriteCommand(DISPLAY_SET_Y | (y&63), 0);
	GLCD_WriteCommand(DISPLAY_SET_Y | 0, 1);
	 }
else{
	GLCD_WriteCommand(DISPLAY_SET_Y | 63, 0);
	GLCD_WriteCommand(DISPLAY_SET_Y | ((y-64)&63), 1);
	 }
}
コード例 #4
0
ファイル: KS0108.c プロジェクト: abarnic/intelligent-ebook
//-------------------------------------------------------------------------------------------------
//
//-------------------------------------------------------------------------------------------------
void GLCD_GoTo(unsigned char x, unsigned char y)
{
unsigned char i;
screen_x = x;
screen_y = y;

for(i = 0; i < KS0108_SCREEN_WIDTH/64; i++)
  {
  GLCD_WriteCommand(DISPLAY_SET_Y | 0,i);
  GLCD_WriteCommand(DISPLAY_SET_X | y,i);
  GLCD_WriteCommand(DISPLAY_START_LINE | 0,i);
  }
GLCD_WriteCommand(DISPLAY_SET_Y | (x % 64), (x / 64));
GLCD_WriteCommand(DISPLAY_SET_X | y, (x / 64));
}
コード例 #5
0
ファイル: KS0108.c プロジェクト: abarnic/intelligent-ebook
//-------------------------------------------------------------------------------------------------
//
//-------------------------------------------------------------------------------------------------
void GLCD_Initalize(void)
{
unsigned char i;
GLCD_InitalizePorts();
for(i = 0; i < 2; i++)
  GLCD_WriteCommand((DISPLAY_ON_CMD | ON), i);
}
コード例 #6
0
ファイル: glcd.c プロジェクト: naminic/Grafical-Lcd-Arm
//---------------------------
void glcd_init(void)
{
	unsigned int tcmr,tfmr;
	unsigned char i;
  
  PIO_Configure(GLcdpins,PIO_LISTSIZE(GLcdpins));
	PIO_Configure(sscPins, PIO_LISTSIZE(sscPins));	
	
	PIO_Set(&GLcdpins[3]);
	PIO_Set(&GLcdpins[4]);
	
	SSC_Configure(AT91C_BASE_SSC,AT91C_ID_SSC,500000,BOARD_MCK);
    
  tcmr=AT91C_SSC_CKS_TK|AT91C_SSC_CKO_DATA_TX|AT91C_SSC_START_CONTINOUS;
  tfmr=SSC_DATLEN(8)|SSC_DATNB(15)|SSC_FSLEN(16)|AT91C_SSC_FSOS_LOW|AT91C_SSC_FSDEN ;
    
  SSC_ConfigureTransmitter(AT91C_BASE_SSC,tcmr,tfmr);
  SSC_EnableTransmitter(AT91C_BASE_SSC);
	
	PIO_Set(&GLcdpins[5]); 
  //PIO_Clear(&GLcdpins[5]);
	for(i = 0; i < 3; i++);
  GLCD_WriteCommand((DISPLAY_ON_CMD | ON), i);
	
}	
コード例 #7
0
//-------------------------------------------------------------------------------------------------------
//   GLCD_ClearText
//-------------------------------------------------------------------------------------------------------
void GLCD_ClearText(uint16_t x,uint16_t y,uint16_t digit)
	{
	int i;
	GLCD_TextGoTo(x,y);
	GLCD_WriteCommand(SED1335_MWRITE);
	for(i = 0; i < digit; i++)
	GLCD_WriteData(' ');
	}
コード例 #8
0
void GLCD_ClearGraphic1(void)
{
unsigned int i;
GLCD_SetCursorAddress(SED1335_GRAPHICSTART);
GLCD_WriteCommand(SED1335_MWRITE);
for(i = 0; i < (40 * 240); i++)
	GLCD_WriteData(0x00);
}
コード例 #9
0
//-------------------------------------------------------------------------------------------------------
//
// Clears text area of display RAM memory
//
//-------------------------------------------------------------------------------------------------------
void GLCD_ClearText1(void)
{
int i;
GLCD_TextGoTo(0,0);
GLCD_WriteCommand(SED1335_MWRITE);
for(i = 0; i < 1200; i++)
	GLCD_WriteData(' ');
}
コード例 #10
0
/*
void GLCD_WriteTextP(char * tekst)
{
GLCD_WriteCommand(SED1335_MWRITE);
while(GLCD_ReadByteFromROMMemory(tekst))
	GLCD_WriteData(GLCD_ReadByteFromROMMemory(tekst++));
}
*/
void GLCD_WriteTextP(PGM_P str)
{
	GLCD_WriteCommand(SED1335_MWRITE);
	while(pgm_read_byte(str) != 0)
	{ 
		GLCD_WriteData(pgm_read_byte(str));
		str++;
	}
}
コード例 #11
0
//-------------------------------------------------------------------------------------------------------
//
// Set (if color==1) or clear (if color==0) pixel on screen
//
//-------------------------------------------------------------------------------------------------------
void GLCD_SetPixel(unsigned int x,unsigned int y, int color)
{
unsigned char tmp = 0;
unsigned int address = SED1335_GRAPHICSTART + (40 * y) + (x/8); 
GLCD_SetCursorAddress(address);

GLCD_WriteCommand(SED1335_MREAD);
tmp = GLCD_ReadData();

if(color)
  tmp |= (1 << (SED1335_FX - (x % 8)));
else
  tmp &= ~(1 << (SED1335_FX - (x % 8)));

GLCD_SetCursorAddress(address);
GLCD_WriteCommand(SED1335_MWRITE);
GLCD_WriteData(tmp);
}
コード例 #12
0
ファイル: lcd.c プロジェクト: maxk9/etro_new
//-------------------------------------------------------------------------------------------------
// Initialization interface and LCD controller
//-------------------------------------------------------------------------------------------------
void GLCD_Initialize(void)
{
    unsigned char i;
    
    GLCD_InitializePorts();
    
    //reset lcd
    GLCD_Reset();
    
    for(i = 0; i < KS0108_SCREEN_WIDTH/64; i++)
      GLCD_WriteCommand((DISPLAY_ON_CMD | ON), i);
}
コード例 #13
0
//-------------------------------------------------------------------------------------------------------
//
// Display initalization
//
//-------------------------------------------------------------------------------------------------------
void GLCD_Initialize(void)
{
GLCD_InitializePorts();

GLCD_WriteCommand(SED1335_SYSTEM_SET); 
GLCD_WriteData(SED1335_SYS_P1);	
GLCD_WriteData(SED1335_SYS_P2);		
GLCD_WriteData(SED1335_FY);		
GLCD_WriteData(SED1335_CR);		
GLCD_WriteData(SED1335_TCR);	
GLCD_WriteData(SED1335_LF);		
GLCD_WriteData(SED1335_APL);	
GLCD_WriteData(SED1335_APH);	
	
GLCD_WriteCommand(SED1335_SCROLL);   
GLCD_WriteData(SED1335_SAD1L);		
GLCD_WriteData(SED1335_SAD1H);		
GLCD_WriteData(SED1335_SL1);		
GLCD_WriteData(SED1335_SAD2L);		
GLCD_WriteData(SED1335_SAD2H);		
GLCD_WriteData(SED1335_SL2);		
GLCD_WriteData(SED1335_SAD3L);		
GLCD_WriteData(SED1335_SAD3H); 		
GLCD_WriteData(SED1335_SAD4L);		
GLCD_WriteData(SED1335_SAD4H);		
	
GLCD_WriteCommand(SED1335_CSRFORM);
GLCD_WriteData(SED1335_CRX);		
GLCD_WriteData(SED1335_CSRF_P2);		
	
GLCD_WriteCommand(SED1335_CGRAM_ADR);       
GLCD_WriteData(SED1335_SAGL);			
GLCD_WriteData(SED1335_SAGH);				
	
GLCD_WriteCommand(SED1335_CSRDIR_R);      

GLCD_WriteCommand(SED1335_HDOT_SCR);       
GLCD_WriteData(SED1335_SCRD);			
	
GLCD_WriteCommand(SED1335_OVLAY);            
GLCD_WriteData(SED1335_OVLAY_P1);			
			
GLCD_WriteCommand(SED1335_DISP_ON);
GLCD_WriteData(SED1335_FLASH);
}
コード例 #14
0
void drawAChar(uint16_t x, int y, int width, int height, unsigned int offset, const unsigned char *fontBitmap)
{
	int pos = offset;
	unsigned char data;
	for(int i = 0; i < height-1 ; i++)
	{
		GLCD_GraphicGoTo(x, y+i);
		GLCD_WriteCommand(SED1335_MWRITE);
		for(int j = 0; j < width/8 ; j++)
		{
			data = pgm_read_byte(&fontBitmap[pos]);
			GLCD_WriteData(data);
			pos++;	
		}
	}
}
コード例 #15
0
//-------------------------------------------------------------------------------------------------
//
// Set (if color==1) or clear (if color==0) pixel on screen
//
//-------------------------------------------------------------------------------------------------
void GLCD_SetPixel(unsigned char x, unsigned char y, unsigned char color)
{
unsigned char tmp;
unsigned int address;

address = GLCD_GRAPHIC_HOME + (x / GLCD_FONT_WIDTH) + (GLCD_GRAPHIC_AREA * y);

GLCD_SetAddressPointer(address);

GLCD_WriteCommand(T6963_DATA_READ_AND_NONVARIABLE);
tmp = GLCD_ReadData();

if(color)
  tmp |= (1 <<  (GLCD_FONT_WIDTH - 1 - (x % GLCD_FONT_WIDTH)));
else
 tmp &= ~(1 <<  (GLCD_FONT_WIDTH - 1 - (x % GLCD_FONT_WIDTH)));

GLCD_WriteDisplayData(tmp);

}
コード例 #16
0
//-------------------------------------------------------------------------------------------------
//
// Display initalization
//
//-------------------------------------------------------------------------------------------------
void GLCD_Initalize(void)
{
    
GLCD_InitalizeInterface();

GLCD_CTRL_PORT &= ~(1 << GLCD_RESET);
_delay_ms(1);
GLCD_CTRL_PORT |= (1 << GLCD_RESET);

#if (GLCD_FONT_WIDTH == 8)
GLCD_CTRL_PORT &= ~(1 << GLCD_FS);
#endif

GLCD_WriteData(GLCD_GRAPHIC_HOME & 0xFF);
GLCD_WriteData(GLCD_GRAPHIC_HOME >> 8);
GLCD_WriteCommand(T6963_SET_GRAPHIC_HOME_ADDRESS);

GLCD_WriteData(GLCD_GRAPHIC_AREA);
GLCD_WriteData(0x00);
GLCD_WriteCommand(T6963_SET_GRAPHIC_AREA);

GLCD_WriteData(GLCD_TEXT_HOME);
GLCD_WriteData(GLCD_TEXT_HOME >> 8);
GLCD_WriteCommand(T6963_SET_TEXT_HOME_ADDRESS);

GLCD_WriteData(GLCD_TEXT_AREA);
GLCD_WriteData(0x00);
GLCD_WriteCommand(T6963_SET_TEXT_AREA);

GLCD_WriteData(GLCD_OFFSET_REGISTER);
GLCD_WriteData(0x00);
GLCD_WriteCommand(T6963_SET_OFFSET_REGISTER);

GLCD_WriteCommand(T6963_DISPLAY_MODE  | T6963_GRAPHIC_DISPLAY_ON   | T6963_TEXT_DISPLAY_ON /*| T6963_CURSOR_DISPLAY_ON*/);

GLCD_WriteCommand(T6963_MODE_SET | 0);

}
コード例 #17
0
ファイル: GLCDLowLevel.c プロジェクト: gaezco/LSE
void GLCD_WriteText(char * tekst)
{
GLCD_WriteCommand(RA8835_MWRITE);
while(*tekst)
	GLCD_WriteData(*tekst++);
}
コード例 #18
0
//-------------------------------------------------------------------------------------------------
//
// Writes display data and increment address pointer
//
//-------------------------------------------------------------------------------------------------
void GLCD_WriteDisplayData(unsigned char x)
{
GLCD_WriteData(x);
GLCD_WriteCommand(T6963_DATA_WRITE_AND_INCREMENT);
}
コード例 #19
0
//-------------------------------------------------------------------------------------------------
//
// Sets address pointer for display RAM memory
//
//-------------------------------------------------------------------------------------------------
void GLCD_SetAddressPointer(unsigned int address)
{
GLCD_WriteData(address & 0xFF);
GLCD_WriteData(address >> 8);
GLCD_WriteCommand(T6963_SET_ADDRESS_POINTER);
}
コード例 #20
0
void LcdInit(void)
{
    int i;
    __delay_cycles(990000);
    __delay_cycles(990000);    
    __delay_cycles(990000);
    __delay_cycles(990000);    
    __delay_cycles(990000);
    __delay_cycles(990000);    

    A0_1;
    RD_1;
    WR_1;
    SED1335_CS_0 ;
    
    RST_0;
    __delay_cycles(990000);
    __delay_cycles(990000);
    RST_1;
    __delay_cycles(990000);
    __delay_cycles(990000);
    RST_0;
    __delay_cycles(990000);
    __delay_cycles(990000);    
    __delay_cycles(990000);
    __delay_cycles(990000);    
    __delay_cycles(990000);
    __delay_cycles(990000);    
     
    GLCD_WriteCommand(SED1335_SYSTEM_SET);
    GLCD_WriteData(SED1335_SYS_P1);
    GLCD_WriteData(SED1335_SYS_P2);
    GLCD_WriteData(SED1335_FY);
    GLCD_WriteData(SED1335_CR);
    GLCD_WriteData(SED1335_TCR);
    GLCD_WriteData(SED1335_LF);
    GLCD_WriteData(SED1335_APL);
    GLCD_WriteData(SED1335_APH);
    
    
    
    GLCD_WriteCommand(SED1335_SCROLL);
    GLCD_WriteData(0);
    GLCD_WriteData(0);
    GLCD_WriteData(0xef);
    GLCD_WriteData(0xb0);
    GLCD_WriteData(0x04);
    GLCD_WriteData(0xef);
    GLCD_WriteData(0);
    GLCD_WriteData(0);
    GLCD_WriteData(0);
    GLCD_WriteData(0);
    
    
    GLCD_WriteCommand(SED1335_CSRFORM);
    GLCD_WriteData(0x04);
    GLCD_WriteData(0x07);
    
    GLCD_WriteCommand(SED1335_CGRAM_ADR);
    GLCD_WriteData(0);
    GLCD_WriteData(0);
    
    GLCD_WriteCommand(SED1335_CSRDIR_R);
    
    GLCD_WriteCommand(SED1335_HDOT_SCR);
    GLCD_WriteData(SED1335_SCRD);
    
    GLCD_WriteCommand(SED1335_OVLAY);
    GLCD_WriteData(0x01);
    
    GLCD_WriteCommand(SED1335_DISP_ON);
    GLCD_WriteData(SED1335_FLASH);
    
    //CLEAR TEXT MODE
    GLCD_WriteCommand(SED1335_CSRW);
    GLCD_WriteData(0);
    GLCD_WriteData(0);

    GLCD_WriteCommand(SED1335_MWRITE);
    for(i = 0; i < 1200; i++)
            GLCD_WriteData(' ');    
    
    
}
コード例 #21
0
//-------------------------------------------------------------------------------------------------------
//
// Writes null-terminated string to display RAM memory
//
//-------------------------------------------------------------------------------------------------------
void GLCD_WriteString(char * tekst)
{
GLCD_WriteCommand(SED1335_MWRITE);
while(*tekst)
	GLCD_WriteData(*tekst++);
}
コード例 #22
0
ファイル: GLCDLowLevel.c プロジェクト: gaezco/LSE
void GLCDLowLevel_Init()
{
	MicroInterface_Init();  				// Init  ports

	//////////////////////////////////
	//			SYSTEM_SET			//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_SYSTEM_SET);	//Writng into command register System set

	GLCD_WriteData(RA8835_SYS_P1);			//P1  M0: Internal CG ROM
											//    M1: CG RAM is 32 characters maximum
											//    M2: 8-pixel character height
											//    W/S: Two-panel drive
											//    IV: No top-line compensation

	GLCD_WriteData(RA8835_SYS_P2);			//P2  FX: Horizontal character size = 8 pixels
											//    WF: Two-frame AC drive

	GLCD_WriteData(RA8835_FY);				//P3  FY: Vertical character size = 8 pixels

	GLCD_WriteData(RA8835_CR);				//P4  C/R: 39 display addresses per line

	GLCD_WriteData(RA8835_TCR);			//P5  TC/R: Total address range per line

	GLCD_WriteData(RA8835_LF);				//P6  L/F: 239 display lines

	GLCD_WriteData(RA8835_APL);			//P7  APL: Virtual screen horizontal size is 40 addresses

	GLCD_WriteData(RA8835_APH);			//P8  APL: Virtual screen horizontal size is 40 addresses


	//////////////////////////////////
	//			  SCROLL			//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_SCROLL);		//Scrolling

	GLCD_WriteData(RA8835_SAD1L);			//P1  First screen block start address set to 0x0000
	GLCD_WriteData(RA8835_SAD1H);			//P2  First screen block start address set to 0x0000

	GLCD_WriteData(RA8835_SL1);			//P3  Display lines in first screen block = 240

	GLCD_WriteData(RA8835_SAD2L);			//P4  Second screen block start address set to 0x1000

	GLCD_WriteData(RA8835_SAD2H);			//P5  Second screen block start address set to 0x1000


	GLCD_WriteData(RA8835_SL2);			//P6  Display lines in second screen block = 240


	GLCD_WriteData(RA8835_SAD3L);			//P7  Third screen block start address set to 0x0000
	GLCD_WriteData(RA8835_SAD3H);			//P8 Third screen block start address set to 0x0000

	GLCD_WriteData(RA8835_SAD4L);			//P9  Fourth screen block start address set to 0x0000
	GLCD_WriteData(RA8835_SAD4H);			//P10  Fourth screen block start address set to 0x0000


	//////////////////////////////////
	//			  HDOT SCR			//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_HDOT_SCR);	// HDOT
	GLCD_WriteData(RA8835_SCRD);			// 0 pixels scroll



	//////////////////////////////////
	//			 OVERLAY			//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_OVLAY);		// OVERLAY

	GLCD_WriteData(RA8835_OVLAY_P1);		//  MX 1, MX 0: Inverse video superposition
											//  DM 1: First screen block is text mode
											//  DM 2: Third screen block is text mode

	//////////////////////////////////
	//			DISPLAY OFF			//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_DISP_OFF);	//Display off

	GLCD_WriteData(RA8835_FLASH);			//FC1, FC0: Flash cursor at 2 Hz
											//FP1, FP0: First screen block ON
											//FP3, FP2: Second and fourth screen blocks ON
											//FP5, FP4: Third screen block ON


	//////////////////////////////////
	//			 CSRW			    //
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_CSRW);
	GLCD_WriteData(RA8835_SAD1L);
	GLCD_WriteData(RA8835_SAD1H);

	//////////////////////////////////
	//			 CSRFORM			//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_CSRFORM);		//Cursor type  CSRFORM

	GLCD_WriteData(RA8835_CRX);			//Horizontal cursor size = 6 pixels

	GLCD_WriteData(RA8835_CRY);			//Vertical cursor size = 9 pixels


	//////////////////////////////////
	//			DISPLAY ON			//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_DISP_ON);		// Display on

	//GLCD_WriteData(RA8835_FLASH);		//FC1, FC0: Flash cursor at 2 Hz
											//FP1, FP0: First screen block ON
											//FP3, FP2: Second and fourth screen blocks ON
											//FP5, FP4: Third screen block ON

	//////////////////////////////////
	//			 CURSOR				//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_CSRDIR_D);	// Set direction of cursor movement RIGHT


	//////////////////////////////////
	//			 CG RAM				//
	//////////////////////////////////

	GLCD_WriteCommand(RA8835_CGRAM_ADR);
	GLCD_WriteData(RA8835_SAGL);
	GLCD_WriteData(RA8835_SAGH);

}
コード例 #23
0
ファイル: GLCDLowLevel.c プロジェクト: gaezco/LSE
void GLCD_SetCursorAddress(unsigned int address)
{
GLCD_WriteCommand(RA8835_CSRW);
GLCD_WriteData((unsigned char)(address & 0xFF));
GLCD_WriteData((unsigned char)(address >> 8));
}
コード例 #24
0
ファイル: glcd.c プロジェクト: naminic/Grafical-Lcd-Arm
//-----------------------
void SetPage(unsigned char x){
	GLCD_WriteCommand(DISPLAY_SET_X | x, 0);
	GLCD_WriteCommand(DISPLAY_SET_X | x, 1);
}