Ejemplo n.º 1
0
void lcd_show_btn(uint8_t btn, uint8_t duration, uint8_t pressed_cnt){
    if(resp_ptr >= disp_line_length){
    	lcd_init_first();
    	for(uint8_t i=(resp_ptr-disp_line_length+1); i<resp_ptr; i++){
    		lcd_putc(response[i]);
    	}
            //shift_display(LEFT);
    }
	if(EdConf.mask) lcd_putc(EdConf.mask); //If mask set than show mask instesd of symbol
	else lcd_putc(get_symbol(btn, duration, pressed_cnt));
	cursor_shift(LEFT);
}
void lcd_display(int16 number, int x, int y)
{
   int unitsPosition, tensPosition, hundredsPosition;

       unitsPosition =number % 10;
       tensPosition = ((number - (number % 10))%100)/10;
       hundredsPosition = ((number - (number%100))%1000)/100;

       lcd_gotoxy(x,y);
       lcd_putc(convertToASCII(hundredsPosition));
       lcd_putc(convertToASCII(tensPosition));
       lcd_putc(convertToASCII(unitsPosition));
}
Ejemplo n.º 3
0
void main() {
set_tris_e(0x00); //e portu output
set_tris_d(0xC0);
lcd_init();
lcd_putc("\f");
lcd_putc("Fatih University");
while(TRUE) {
	output_high(PIN_E0);	//e1 high
	delay_ms(200);			//bekle
	output_low(PIN_E0);	//e2 high
	delay_ms(200);
   }
}
Ejemplo n.º 4
0
void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lattr, uint8_t rattr)
{
  lcd_putc(x-4, y, '[');
  lcd_outdezAtt(x, y, lswTimerValue(cs->v2), LEFT|PREC1|lattr);
  lcd_putc(lcdLastPos, y, ':');
  if (cs->v3 < 0)
    lcd_putsAtt(lcdLastPos+3, y, "<<", rattr);
  else if (cs->v3 == 0)
    lcd_putsAtt(lcdLastPos+3, y, "--", rattr);
  else
    lcd_outdezAtt(lcdLastPos+3, y, lswTimerValue(cs->v2+cs->v3), LEFT|PREC1|rattr);
  lcd_putc(lcdLastPos, y, ']');
}
Ejemplo n.º 5
0
static void showturn(uint8_t id)
{
  if (countdown_is_running(id))
  {
    lcd_putc('*');
  }
  else if (was_running & (1<<id))
  {
    lcd_putc('=');
  }
  else
  {
    lcd_putc(' ');
  }
}
Ejemplo n.º 6
0
//*******************************************************************************************
//
// Function : standby_display
// Description : display board status such as AVR ip, server ip, countdown time, temparature
//
//*******************************************************************************************
void standby_display ( void )
{
	BYTE generic_buf[64];

	// update lcd display flag not set, exit from function
	if ( flag1.bits.update_display == 0 )
		return;
	flag1.bits.update_display = 0;
	// lcd display is displaying other information, wait until busy flag clear
	if ( flag1.bits.lcd_busy )
		return;
	// now displaying menu information, wait until exit from menu
	if ( menu_index )
		return;

	// display status on lcd line 1
	lcd_putc ( '\f' );
	lcd_print ( (BYTE*)standby_list[ standby_cursor - 1 ] );

	// display status devices on lcd line 2
	lcd_putc ( '\n' );
	if ( standby_cursor == 1 )
	{
		print_devices (generic_buf,ind_device_cur);
		
	}
	// display avr ip
	if ( standby_cursor == 2 )
	{
		print_ip ( generic_buf, (BYTE*)&avr_ip, 0 );
	}
	// display server ip
	else if ( standby_cursor == 3 )
	{
		print_ip ( generic_buf, (BYTE*)&server_ip, 0 );
	}
	// display countdown timer
	else if ( standby_cursor == 4 )
	{
		print_time ( generic_buf, count_time, 0 );
	}
	// display current temparature
	else if ( standby_cursor == 5 )
	{
		print_temp ( generic_buf );
	}
	lcd_print ( generic_buf );
}
Ejemplo n.º 7
0
//*******************************************************************************************
//
// Function : display_menu
// Description : display LCD user interface menu on LCD
//
//*******************************************************************************************
void display_menu(void)
{
	BYTE generic_buf[64];

	if( menu_index == 0)
		return;

	// display menu title on lcd first line
	lcd_putc( '\f' );
	lcd_print ( (BYTE *)menu_list[ menu_index - 1 ] );
	
	// display menu detail on lcd second line
	lcd_putc( '\n' );
	if( menu_index == 1 )//MENU_MAIN)
	{
		lcd_print( (BYTE *)menu_list[ submenu_index ] );
	}
	// setup avr ip address
	else if( menu_index == 2 )
	{
		print_ip ( generic_buf, (BYTE*)&avr_ip, setting_cursor+1 );
		lcd_print ( generic_buf );
	}
	// setup server ip address
	else if(menu_index == 3 )
	{
		print_ip ( generic_buf, (BYTE*)&server_ip, setting_cursor+1 );
		lcd_print ( generic_buf );
	}
	// setup countdown timer for send temparature
	else if ( menu_index == 4 )
	{
		print_time ( generic_buf, count_time, setting_cursor+1 );
		lcd_print ( generic_buf );
	}
	// ping server
	else if ( menu_index == 5 )
	{
		print_ip ( generic_buf, (BYTE*)&server_ip, 1 );
		lcd_print ( generic_buf );
	}
	// send temparature now
	//else if ( menu_index == 6 )
	//{
	//	lcd_put ( ASCII_CURSOR );
	//	lcd_print_p ( PSTR ( "OK" ) );
	//}
}
Ejemplo n.º 8
0
/*************************************************************************
  Display string
Input:    string to be displayed
Returns:  none
 *************************************************************************/
void lcd_puts(const char *s)
{
	register char c;

	while ((c=*s++)) 
		lcd_putc(c);
}
Ejemplo n.º 9
0
/**
 * Load a program by reading it from the terminal program over the serial line.
 * LOAD "<filename>"
 */
void cmd_load(char *args) {
  char *filename;
  if (parse_string_expression(args, &filename)) {
    cmd_new(0);
    lcd_puts("Loading...");
    acia_puts("*LOAD \"");
    acia_puts(filename);
    acia_puts("\"\n");
    for(;;) {
      acia_puts("*NEXT\n");
      acia_gets(readline_buffer, 255);
      if (strncmp("*EOF", readline_buffer, 4) == 0) {
        break;
      } else if (strncmp("!NOTFOUND", readline_buffer, 9) == 0) {
        lcd_put_newline();
        syntax_error_msg("File not found");
        break;
      } else {
        lcd_putc('.');
        interpret(readline_buffer);
      }
    }
    if (! error) {
      lcd_put_newline();
      print_ready();
    }
  } else {
    syntax_error_invalid_argument();
  }
}
Ejemplo n.º 10
0
/*!	\brief Mavlink General setup menu.
 *	\details Setup menu for generic mavlink settings.
 *	Current menu items
 *	- RC RSSI scale item. Used to adjust the scale of the RSSI indicator to match
 *	the actual rssi value
 *	- PC RSSI enable item. Can be used to dissable PC RSSI display if not used.
 *	This funcion is called from the model setup menus, not directly by the
 *	telemetry menus
 */
void menuTelemetryMavlinkSetup(uint8_t event) {
	
	MENU(STR_MAVMENUSETUP_TITLE, menuTabModel, e_MavSetup, ITEM_MAVLINK_MAX + 1, {0, 0, 1/*to force edit mode*/});
	
	uint8_t sub = m_posVert - 1;

	for (uint8_t i=0; i<LCD_LINES-1; i++) {
		uint8_t y = 1 + 1*FH + i*FH;
		uint8_t k = i+s_pgOfs;
		uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
		uint8_t attr = (sub == k ? blink : 0);
		switch(k) {	
		case ITEM_MAVLINK_RC_RSSI_SCALE:
			lcd_putsLeft(y, STR_MAVLINK_RC_RSSI_SCALE_LABEL);
			lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, (25 + g_model.mavlink.rc_rssi_scale * 5), attr|LEFT);
			lcd_putc(lcdLastPos, y, '%');
			if (attr) CHECK_INCDEC_MODELVAR(event, g_model.mavlink.rc_rssi_scale, 0, 15);
			break;
		case ITEM_MAVLINK_PC_RSSI_EN:
			g_model.mavlink.pc_rssi_en = onoffMenuItem(g_model.mavlink.pc_rssi_en,
				RADIO_SETUP_2ND_COLUMN,
				y,
				STR_MAVLINK_PC_RSSI_EN_LABEL,
				attr,
				event);
			break;
		}
	}
}
Ejemplo n.º 11
0
void prvLcdShow( void *pvParameters )
{
    uint8_t symb, buffer_cnt=0, el_in_queue=0;
    portBASE_TYPE xStatus;

    while(1){
    	el_in_queue = uxQueueMessagesWaiting(xQueueLCD);
    	if(el_in_queue > 0){
    		if(xSemaphoreTake(xLcdMutex, portMAX_DELAY) == pdPASS){
            	while(el_in_queue > 0){
            		if(xQueueReceive(xQueueLCD, &symb, 0) == pdPASS){
            			if (buffer_cnt == 32){
							lcd_clrscr();
							buffer_cnt = 0;
						}
						if(buffer_cnt == 16){
							lcd_goto(2,0);
						}
						lcd_putc(symb);
						buffer_cnt++;
						el_in_queue--;
            		}
            	}
            	xSemaphoreGive(xLcdMutex);
    		}
    	}
    }
}
Ejemplo n.º 12
0
//==================================================================================
// Prints space characters on LCD starting from the last used LCD address.
// This function is used to erase previous printed data on LCD from specific location.
//==================================================================================
void placeEmptyCharacters (char charsNumber[8], unsigned char emptySpacesNumber)
{
	unsigned char length, i;
	length = strlen(charsNumber);
	for(i=0;i<(emptySpacesNumber - length);i++)
		lcd_putc(' ');	
}	
Ejemplo n.º 13
0
int main(void){
  initIO();			//Initialize I/O
  initTimer();
  initComparator();	//Initialize the analog comparator
  lcd_init(LCD_DISP_ON);
  /*
  char buff[7];
  itoa(T_CLOCK,buff,10);
  lcd_puts(buff);
  itoa(ERROR_MARGIN,buff,10);
  lcd_puts(buff);
  */
  
 
  while(1) { 
 
    if (bit_flag) { 
      //lcd_puts("0" + last_bit);	//This math turns a single-digit char into it's ASCII equivalent
      if (last_bit != 0x0F) lcd_putc(last_bit);
      //else lcd_puts("0");
      bit_flag = 0;
    }
    
    if (sync_lost) {
      if (sync_lost == 2) lcd_puts("LOST-2T");
      else lcd_puts("LOST-T");
      lcd_gotoxy(0,1);
      char buff[7];
      itoa(timervalue,buff,10);
      lcd_puts(buff);
      while(1) {}
    }
    
  }
}
Ejemplo n.º 14
0
//-------------------------------
void lcd_load(int8u_t* vector, int8u_t position)
{/* USE CGRAM CHAR SPACE: 0 to 7 */
 int8u_t i;
 lcd_goto(CGRAM,position*DRAW_CHAR_SIZE);
 for(i=0;i<DRAW_CHAR_SIZE;i++)
  lcd_putc(vector[i]);
}
Ejemplo n.º 15
0
/*************************************************************************
  Display string from flash
Input:    string to be displayed
Returns:  none
 *************************************************************************/
void lcd_puts_P(const char *progmem_s)
{
	register char c;

	while ((c=pgm_read_byte(progmem_s++))) 
		lcd_putc(c);
}
void lcd_put_fuel (
	int8_t val,		/* Fuel level (-1:plugged, 0:empty cell, ..., 5:full cell) */
	uint8_t chr		/* User character to use */
)
{
	static const uint8_t plg[8] = {10,10,31,31,14,4,7,0};
	uint8_t gfx[8], d, *p;
	int8_t i;


	if (val >= 0) {		/* Cell (0..5) */
		p = &gfx[8];
		*(--p) = 0; *(--p) = 0x1F;
		for (i = 1; i <= 5; i++) {
			d = 0x1F;
			if (val < i) d = (i == 5) ? 0x1B : 0x11;
			*(--p) = d;
		}
		*(--p) = 0x0E;
	} else {			/* Plug (-1) */
		p = (uint8_t*)plg;
	}
	lcd_setcg(chr, 1, p);
	lcd_putc(chr);
}
Ejemplo n.º 17
0
Archivo: scpi.c Proyecto: alexpriem/avr
int scpi_parse_line (char *s)
{
 uint8_t retval,key;
 char *s2;
 char  buf[10];

 *return_buf=0;
 key=scpi_parse_command (s,&s2);

  uart_puts ("\n\rcmd:");
 itoa (key,buf, 10);
 uart_puts (buf);
 uart_puts ("[");
 uart_puts (s2);

 retval=scpi_function (key, s2);
 if (*return_buf) {
     #ifdef DEBUG
         lcd_putc ('\n');
         lcd_puts (return_buf);
     #endif 
     uart_puts (return_buf);
    }

 return retval;
}
Ejemplo n.º 18
0
void Escribir_KEY(){
   if (teclanew == 1){
         ConvTecla ();
         lcd_putc(tecla);
         teclanew=0;
   }
}
Ejemplo n.º 19
0
uint8_t LCD_service::display_TUN_packet(uint8_t* m_TUN_storage)
{
	// x and y coordinates
	uint8_t x = 0;
	uint8_t y = 0;
	uint8_t LCD_payload_sz = 0;

	// temp storage
	uint8_t LCD_payload[MED_BUFF_SZ];
	
	// extract the LCD packet
	LCD_payload_sz = m_util.get_TUN_payload(m_TUN_storage, LCD_payload, MED_BUFF_SZ);
	
	if(LCD_payload_sz != 0)
	{
	
		// get the X and Y coordinates
		x = m_util.hex_to_int(LCD_X_START, LCD_X_END, LCD_X_SZ, LCD_payload);
		y = m_util.hex_to_int(LCD_Y_START, LCD_Y_END, LCD_Y_SZ, LCD_payload);
	
		// figure out the msg size
		LCD_payload_sz -= (LCD_X_SZ + LCD_Y_SZ);
	
		// clear the line
		clear_line(x);
	
		// set the cursor
		lcd_setCursor(x, y);
	
		// display the string
		for(uint8_t i = 0; i < LCD_payload_sz; i++)
			lcd_putc((const char)LCD_payload[i+LCD_MSG_START]);
	}
}
Ejemplo n.º 20
0
/*!	\details	Writes ANSI-C string to LCD (DDRAM memory space). */
void lcd_puts(const uint8_t *str)
{
	/* Send a ANSI-C string to LCD. */
	while ('\0' != *str)
	{
#if ( USE_FORMATTED_OUTPUT )
		if(('\n' == *str))
		{/*New line */
			lcd_goto(LCD_2nd_LINE, 0u);
		}
		else if(('\r' == *str))
		{/* Return home */
			lcd_return();
		}
		else if(('\t' == *str))
		{/* Tab space */
			uint8_t i;

			for(i=0u; i<TAB_SPACE; i++)
			{/* Shift cursor to the right. */
				cursor_shift(RIGHT);
			}
		}
		else
#endif
		{
			/* Display a symbol. */
			lcd_putc(*str);
		}
		/* Get the next symbol. */
		str++;
	}
}
Ejemplo n.º 21
0
void lcd_prints(const int8u_t *p)
{
	while(*p)
	{
		lcd_putc(*p++);
	}
}
Ejemplo n.º 22
0
int main(void)
{
	char serialCharacter;
	
	lcd_init(LCD_DISP_ON);
	lcd_gotoxy(2,0); lcd_puts("Serial");
	lcd_gotoxy(3,1); lcd_puts("LCD");
	
	DDRD |= (1<<PD1);	// habilita o pino PD1 como TXD (output)
	DDRB |= (1<<PB0);	// habilita o LED no pino PB0
	
	PORTB|=(1<<PB0);
	
	initUSART();
	printString("Serial ok:");
	
	PORTB&=~(1<<PB0);
	
    while(1)
    {	PORTB|=(1<<PB0);
        serialCharacter = receiveByte();
		PORTB&=~(1<<PB0);
		lcd_putc(serialCharacter);
    }
}
Ejemplo n.º 23
0
static void charging_display_info(bool animate)
{
    int battv;
    unsigned i, ypos;
    static unsigned phase = 3;
    char buf[32];

    battv = battery_voltage();
    lcd_putsf(4, 1, " %d.%02dV", battv / 1000, (battv % 1000) / 10);

    memcpy(buf, logo_pattern, 32); /* copy logo patterns */

    if (!animate) /* build the screen */
    {
        lcd_double_height(false);
        lcd_puts(0, 0, "[Charging]");
        for (i = 0; i < 4; i++)
            lcd_putc(i, 1, logo_chars[i]);
    }
    else          /* animate the logo */
    {
        for (i = 3; i < MIN(19, phase); i++)
        {
            if ((i - phase) % 5 == 0)
            {    /* draw a "bubble" here */
                ypos = (phase + i/5) % 9; /* "bounce" effect */
                if (ypos > 4)
                    ypos = 8 - ypos;
                buf[5 - ypos + 8 * (i/5)] |= 0x10u >> (i%5);
            }
        }
        phase++;
    }
Ejemplo n.º 24
0
void menu_display_status(void)
{
    static uint8_t cnt_main_monitor;

    //lcd_clear_line( 1 );

    //lcd_clear_line( 2 );
    lcd_gotoxy( 17, 2 ); lcd_puts("   ");
    lcd_gotoxy( 0, 2 );
    lcd_puts("MQTT/UDP:");
    lcd_puti( mqtt_io_count % 100 ); // Take 2 digits

/*
    lcd_puts(" ModBus:");
    lcd_puti( modbus_event_cnt % 100 ); // Take 2 digits
    lcd_putc( (cnt_main_monitor++ & 1) ? ':' : '.' );
    lcd_puti( (modbus_crc_cnt+modbus_exceptions_cnt) % 100 ); // Take 2 digits
    //lcd_puts("  ");
*/
    //lcd_clear_line( 3 );
    lcd_gotoxy( 16, 3 ); lcd_puts("    ");
    lcd_gotoxy( 0, 3 );
    lcd_puts("EEprom:");
    lcd_putc( ui_marker_unsaved ? '*' : '.' );
    lcd_puts(" 1WErr:");
    lcd_puti( ow_error_cnt % 100 ); // Take 2 digits
    //lcd_puts("  ");

    lcd_gotoxy( 0, 0 );
    lcd_puts("IO Status  ");
}
Ejemplo n.º 25
0
DSTATUS disk_initialize (
	BYTE pdrv				/* Physical drive nmuber to identify the drive */
)
{
	DSTATUS stat;
	int result=1;

	switch (pdrv) {
	case DEV_RAM :
		//RAM_disk_initialize();

		// translate the reslut code here

		return stat;

	case DEV_MMC :
      {
         lcd_putc('m');
		result = mmc_disk_initialize();

		// translate the reslut code here

		return stat;
      }
	case DEV_USB :
		//result = USB_disk_initialize();

		// translate the reslut code here

		return stat;
	}
	return STA_NOINIT;
}
Ejemplo n.º 26
0
int main(void) 
{
	// don't know why this is incorrect
	SystemCoreClock = 100000000;
	SysTick_Config(SystemCoreClock / 1000);

	timeout_ms=0;
	
	UART0_Init(115200);


	sspInit();
	lcdInit();


	// sets SystemCoreClock to 44583722, but why ? 
	SystemCoreClockUpdate();


	lcd_plot (1, 1, 1);
	lcd_putc (1,1,'c',1);


	while(1)
	{
	}
}
Ejemplo n.º 27
0
static int loadImageFromUsbToRam(const char *pcFileName, void *pvOutBuffer, int *pnOutLength)
{
	long nReadFileSize = 0;
	int nMaxLength = 0;

	if (pcFileName==NULL || pvOutBuffer == NULL || pnOutLength==NULL) {
		debug("[loadImageFromUsbToRam] pcFileName: %p pvOutBuffer: %p pnOutLength: %p\n", pcFileName, pvOutBuffer, pnOutLength);
		return FALSE;
	}

#ifdef CONFIG_ATMEL_LCD
	lcd_printf("System is reading image from USB storage, please wait");
#endif

	nMaxLength = *pnOutLength;
	memset(pvOutBuffer, 0xFF, nMaxLength);
	nReadFileSize = file_fat_read(pcFileName, pvOutBuffer, nMaxLength);
	if (nReadFileSize < 0) {
		debug("[loadImageFromUsbToRam] pcFileName: %p pvOutBuffer: %p pnOutLength: %p\n", pcFileName, pvOutBuffer, pnOutLength);
		return FALSE;
	}

	debug("[loadImageToRam] pcFileName: %s pvOutBuffer: %d nReadFileSize: %d\n", pcFileName, pvOutBuffer, nReadFileSize);

	*pnOutLength = nReadFileSize;

#ifdef CONFIG_ATMEL_LCD
	lcd_putc('\n');
#endif
	
	return TRUE;
	
}
Ejemplo n.º 28
0
static void handle_command(char *buffer) {
    if (strncmp(buffer, "^BEEP", strlen("^BEEP")) == 0) {
        /* Summer-Ausschalten auf 100ms bzw. 500ms setzen */
        if (buffer[6] == '1')
            beepcnt = 100;
        else if (buffer[6] == '2')
            beepcnt = 25;
        else beepcnt = 500;

        /* Summer aktivieren */
        PORTB |= (1 << PB4);
        return;
    }

    if (strncmp(buffer, "^PING", strlen("^PING")) == 0) {
        /* Modify the buffer in place and send it back */
        buffer[2] = 'O';
        uart_puts(buffer);
        return;
    }

    // example:
    // ^LED 0 250                           $ (rot oben)
    // ^LED 1 250                           $ (grün oben)
    // (beides zusammen ergibt orange)
    // ^LED 2 250                           $ (rot unten)
    // ^LED 3 250                           $ (grün unten)
    // ^BEEP 1                              $
    if (strncmp(buffer, "^LED", strlen("^LED")) == 0) {
        int idx = (buffer[5] - '0');
        if (idx < 0 || idx > 3)
            return;

        if (sscanf(buffer + strlen("^LED 0 "), "%u", &(led_state[idx])) != 1)
            return;

        PORTB |= (1 << idx);
        return;
    }

    // ^LCD Herzlich Willkommen im RZL      $
    // ^LCD PIN: *                          $
    // ^LCD PIN: **                         $
    if (strncmp(buffer, "^LCD", strlen("^LCD")) == 0) {
        lcd_clrscr();
        char *walk = buffer + strlen("^LCD ") + 31;
        while (*walk == ' ')
            walk--;
        *(++walk) = '\0';
        lcd_puts(buffer + strlen("^LCD "));
        return;
    }

    // ^LCH *                               $
    if (strncmp(buffer, "^LCH", strlen("^LCH")) == 0) {
        lcd_putc(buffer[strlen("^LCD ")]);
        return;
    }
}
Ejemplo n.º 29
0
Archivo: lcd.c Proyecto: jcmvbkbc/stove
void lcd_puts(const char *str)
{
	uint8_t x = lcd_addr & (LCD_STRIDE - 1);

	for (; x < LCD_STRIDE && *str; ++x, ++str) {
		lcd_putc(*str);
	}
}
void initialDisplay()
{
     delay_ms(25);
     lcd_init();

     lcd_gotoxy(1,1);
     lcd_putc("SYSTEM STARTED..");
     lcd_gotoxy(1,2);
     lcd_putc("================");
     delay_ms(500);
     lcd_gotoxy(1,1);
     lcd_putc("\fNumberInside:");
     lcd_display(noOfPeople,14,1);
     lcd_gotoxy(1,2);
     lcd_putc("Temperature:   C");

}