Ejemplo n.º 1
0
Archivo: echo.c Proyecto: psachin/uC
int main(void)
{
	uint8_t data;
	lcd_init();
	uart_init(38400);
	for (;;) {
		data = uart_recv_byte();
		lcd_put_char(data);
		uart_send_byte(data);
	}
}
Ejemplo n.º 2
0
char lcd_put_string (char * pstr, char len)
{
	char i;
	
	if (len >= (BUFFER_LCD_SIZE - buffer_lcd_counter))
		return -1;  // se não cabe mais no buffer de lcd...
	
	for (i = 0; i < len; i++) {
		lcd_put_char (pstr[i]);
	}
	return 0;
}
Ejemplo n.º 3
0
/*----------------------------------------------------------------------------*/
static void display()
{
  int width, height, y, index;
  width = lcd_width();
  height = lcd_height();
  lcd_clear();
  index = view_data.index;

  if((index >= view_data.string_count - height + 1) && (index >= height - 1))
    index -= height - 1;

  for(y = 0; y < height; y++)
  {
    char *str = 0;
    int size = 0, x = 1;
    SCR_ALIGN align = SCR_ALIGN_LEFT;
    if(index < view_data.string_count)
      view_data.get(view_data.data, index, &str, &align);
    if(str != 0)
    {
      size = strlen(str);
      if(align == SCR_ALIGN_CENTER)
        x = 1 + (width - size) / 2;
      else
        if(align == SCR_ALIGN_CENTER)
          x = 1 + width - size;
      if(size >= width && index == view_data.index)
      {
        lcd_add_scroll_text(y, 1, width - 1, str);
      }
      else
      {
        if(x < 1)
          x = 1;
        for(; x < width && *str; x++)
        {
          lcd_put_char(x, y, *str);
          str ++;
        }
      }
    }
    index ++;
  }

  draw_cursor();
}
Ejemplo n.º 4
0
/*----------------------------------------------------------------------------*/
static void display()
{
  int width, x;
  char buffer[16], fmt[16], *p;
  width = lcd_width();
  lcd_clear();
  if(strlen(spin_data.caption) > width)
    lcd_add_scroll_text(0, 0, width, spin_data.caption);
  else
    lcd_put_line(0, spin_data.caption, SCR_ALIGN_CENTER);

  snprintf(fmt, sizeof(fmt), "%%-%dd", spin_data.size);
  snprintf(buffer, sizeof(buffer), fmt, value);
  x = (width - spin_data.size) / 2;
  p = buffer;
  while(*p && x < width)
  {
    lcd_put_char(x, 1, *p);
    x ++; p ++;
  }
  draw_cursor();
}
Ejemplo n.º 5
0
void print_frequency(u8 freq)
{
	char foo = freq | 0x30;
	lcd_put_char(foo);
	lcd_print("00Hz");
}
Ejemplo n.º 6
0
void lcd_put_string (char * s) {
  while (s[0] != 0) {
    lcd_put_char (s[0]);
    s++;
  }
}