Exemplo n.º 1
0
int main(void)
{
	sysclk_init();
	board_init();

	configure_lcd();
	configure_botao();
	configure_adc();
	configure_tc();
		ili93xx_set_foreground_color(COLOR_BLACK);
	ili93xx_draw_string(10, 20, (uint8_t *)"14 - ADC");
	

	/** Draw text, image and basic shapes on the LCD */
	//ili93xx_set_foreground_color(COLOR_BLACK);
	//ili93xx_draw_string(10, 20, (uint8_t *)"14 - ADC");

	while (1) {
		if(adc_value_new == 1)
		{
		refresh_lcd(adc_value_old);
		adc_value_new = 0;
		}
	}
}
Exemplo n.º 2
0
/*
	This function prints and records the input character. 
just_record:		If just_record is true, the character won't be printed and just recorded  in the cache.
*/
void append_char(uint8_t _char) {
	int last_line_to_append;
	//Reached to the end of row
	if( last_col_cahche >= LCD_WIDTH ) {
		last_col_cahche = 0;

		++cache_size;

		if( cache_size >= CACHE_LINE_CAP ) {
			cache_start = (cache_start + 1) % CACHE_LINE_CAP;
			--cache_size;
		}

		if( window_size >= LCD_HEIGTH - 1 ) {
			window_start = ( window_start + 1 ) % CACHE_LINE_CAP;
			--window_size;
			refresh_lcd();
		}

		++window_size;


	}

	if(_char == '\n') {
		last_col_cahche = LCD_WIDTH + 1;
	} else {
		last_line_to_append = window_size;
		GLCD_DisplayChar ( last_line_to_append, last_col_cahche, FONT_SIZE, _char);

		chache[last_line()][last_col_cahche] = _char;
		++last_col_cahche;
		chache[last_line()][last_col_cahche] = 0x0;
	}
}
Exemplo n.º 3
0
static void Button2_Handler(uint32_t id, uint32_t mask)
{
	count ++;

	sprintf(stringct,"Contador: %i",count);
	refresh_lcd(stringct,215);
}
Exemplo n.º 4
0
/**
 *  Handle Interrupcao botao 2.
 */
static void Button3_Handler(uint32_t id, uint32_t mask)
{
	//tc_write_rc(TC0, 0, tc_read_rc(TC0, 0) - 2730);

	count --;

	sprintf(stringct,"Contador: %i",count);
	refresh_lcd(stringct,215);
}
Exemplo n.º 5
0
void moveDown( void ) {

	if(last_line() != last_window_line() ) {
		window_start = (window_start + 1) % CACHE_LINE_CAP;
		if( window_size < LCD_HEIGTH - 1)
			--window_size;
		refresh_lcd();
	}

}
Exemplo n.º 6
0
void moveUp( void ) {

	if(window_start != cache_start) {
		window_start = (window_start - 1) % CACHE_LINE_CAP;
		if( window_size < LCD_HEIGTH - 1 )
			++window_size;
		refresh_lcd();
	}

}
Exemplo n.º 7
0
void moveFirst( void ) {

	if(window_start != cache_start) {
		window_start = cache_start;
		if( cache_size >= LCD_HEIGTH ) {
			window_size = LCD_HEIGTH - 1;
		}

		refresh_lcd();
	}
}
Exemplo n.º 8
0
/* Write 16 chars to LCD */
void dump_to_lcd()
{
   unsigned short int i;
   unsigned char chr;

   for(i=0; i<16; i++)
   {
     /* Read from EEPROM */
     HDByteReadI2C(0xA0, 0x00, i, &chr, 0x01);
     
     /* Write to LCD */
     refresh_lcd();
     send_to_lcd(chr, 0);
     wait_busy_lcd();
   }
}
Exemplo n.º 9
0
void moveLast( void ) {
	int a, b, c;

	if( last_line() != last_window_line() ) {
		if( cache_size < LCD_HEIGTH ) {
			window_start = cache_start;
		} else {
			a = last_line();
			b = window_size; 
			c = (a > b ? a - b : a - b  + CACHE_LINE_CAP ) ;
			window_start = c % CACHE_LINE_CAP;
		}

		refresh_lcd();
	}

}
Exemplo n.º 10
0
void TC0_Handler(void)
{
	volatile uint32_t ul_dummy;

	/* Clear status bit to acknowledge interrupt */
	ul_dummy = tc_get_status(TC0,0);

	/* Avoid compiler warning */
	UNUSED(ul_dummy);

	/** Muda o estado do LED */

	sec ++;
	sprintf(stringsec,"Tempo: %i",sec);
	refresh_lcd(stringsec,240);

}