// print text
// ----------------------------------------------------------
void RAIO_print_text( uint16_t pos_x, uint16_t pos_y, unsigned char *str, uint8_t BG_color, uint8_t FG_color )
{
	union my_union number;
	
	// set cursor
	number.value = pos_x;
	RAIO_SetRegister( CURH0, number.split.low );
	RAIO_SetRegister( CURH1, number.split.high );
	
	number.value = pos_y;
	RAIO_SetRegister( CURV0, number.split.low );
	RAIO_SetRegister( CURV1, number.split.high );
	
	// set color 
	Text_Background_Color( BG_color );
	Text_Foreground_Color( FG_color );
	
	// set text mode
	RAIO_SetRegister( MWCR0, 0x80 );
	
	// write text to display
	TFT_RegWrite( MRWC );
	
	while ( *str != '\0' )
	{
		TFT_DataWrite( *str );
		++str;
		TFT_wait_for_raio();
	}
	
	TFT_wait_for_raio();
	
	// set graphic mode
	RAIO_SetRegister( MWCR0, 0x00 );
}
// show the BMP picture on the TFT screen
// ----------------------------------------------------------
void RAIO_Write_Picture( uint16_t *data, uint32_t count )
{
	TFT_RegWrite( MRWC );
	TFT_DataMultiWrite( data, count);
	
#ifdef CM_4K
	if ( BankNo_WR==0 )
	{
		BankNo_WR=1;
		BankNo_RD=0;
	}
	else
	{
		BankNo_WR=0;
		BankNo_RD=1;
	}
		
	RAIO_SetRegister( MWCR1, BankNo_WR );
	RAIO_SetRegister( LTPR0, BankNo_RD );	
#endif
}
// write command to a register
// ----------------------------------------------------------
void RAIO_SetRegister( uint8_t reg, uint8_t value )
{
    TFT_RegWrite( (uint16_t)reg );
    TFT_DataWrite( (uint16_t)value );
}
Ejemplo n.º 4
0
// read command from a register
// ----------------------------------------------------------
uint16_t RAIO_GetRegister( uint8_t reg )
{
    TFT_RegWrite( (uint16_t) reg );
    return TFT_DataRead();
}