Пример #1
0
void updateHD44780lcd(void) {

	lcd_HD44780_set_position(0, 9);
	/**
	 * this would blink so that we know the LCD is alive
	 */
	if (getTimeNowSeconds() % 2 == 0) {
		lcd_HD44780_print_char('R');
	} else {
		lcd_HD44780_print_char(' ');
	}
	lcd_HD44780_set_position(0, 10);

	char * ptr = itoa10(buffer, getRpm());
	ptr[0] = 0;
	int len = ptr - buffer;
	for (int i = 0; i < 6 - len; i++) {
		lcd_HD44780_print_char(' ');
	}
	lcd_HD44780_print_string(buffer);

	if (hasFirmwareError()) {
		memcpy(buffer, getFirmwareError(), LCD_WIDTH);
		buffer[LCD_WIDTH] = 0;
		lcd_HD44780_set_position(1, 0);
		lcd_HD44780_print_string(buffer);
		return;
	}

	lcd_HD44780_set_position(1, 0);
	memset(buffer, ' ', LCD_WIDTH);
	memcpy(buffer, getWarninig(), LCD_WIDTH);
	buffer[LCD_WIDTH] = 0;
	lcd_HD44780_print_string(buffer);

	if (engineConfiguration->HD44780height < 3) {
		return;
	}

	int index = (getTimeNowSeconds() / 2) % (NUMBER_OF_DIFFERENT_LINES / 2);

	prepareCurrentSecondLine(index);
	buffer[LCD_WIDTH] = 0;
	lcd_HD44780_set_position(2, 0);
	lcd_HD44780_print_string(buffer);

	prepareCurrentSecondLine(index + NUMBER_OF_DIFFERENT_LINES / 2);
	buffer[LCD_WIDTH] = 0;
	lcd_HD44780_set_position(3, 0);
	lcd_HD44780_print_string(buffer);

#if EFI_PROD_CODE
	dateToString(dateBuffer);
	lcd_HD44780_set_position(1, 0);
	lcd_HD44780_print_string(dateBuffer);
#endif /* EFI_PROD_CODE */
}
Пример #2
0
int main(void) {

lcd_HD44780_init();
	setbuf(stdin, NULL);
	int symbol;
while (0) {
	lcd_HD44780_print_char(27);
}
	while ((symbol = getch()) != EOF) {
	    lcd_HD44780_print_char(symbol);
	}

}
Пример #3
0
void lcd_HD44780_print_string(char* string) {
	while (*string != 0x00)
		lcd_HD44780_print_char(*string++);
}
Пример #4
0
void updateHD44780lcd(Engine *engine) {
	MenuItem *p = tree.topVisible;
	int screenY = 0;
	for (; screenY < tree.linesCount && p != NULL; screenY++) {
		lcd_HD44780_set_position(screenY, 0);
		char firstChar;
		if (p == tree.current) {
			if (p->callback != NULL) {
				firstChar = '!';
			} else {
				firstChar = p->firstChild == NULL ? '*' : '>';
			}
		} else {
			firstChar = ' ';
		}
		lcd_HD44780_print_char(firstChar);
		if (p->lcdLine == LL_STRING) {
			lcd_HD44780_print_string(p->text);
		} else {
			showLine(p->lcdLine, screenY);
		}
		fillWithSpaces();
		p = p->next;
	}

	for (; screenY < tree.linesCount; screenY++) {
		lcd_HD44780_set_position(screenY, 0);
		fillWithSpaces();
	}

	memcpy(buffer, getWarninig(), engineConfiguration->HD44780width);
	buffer[engineConfiguration->HD44780width] = 0;
	lcd_HD44780_set_position(engineConfiguration->HD44780height - 1, 0);
	lcd_HD44780_print_string(buffer);
	fillWithSpaces();

//
//	lcd_HD44780_set_position(0, 9);
//	/**
//	 * this would blink so that we know the LCD is alive
//	 */
//	if (isEven) {
//		lcd_HD44780_print_char('R');
//	} else {
//		lcd_HD44780_print_char(' ');
//	}
//	lcd_HD44780_set_position(0, 10);
//
//	char * ptr = itoa10(buffer, getRpmE(engine));
//	ptr[0] = 0;
//	int len = ptr - buffer;
//	for (int i = 0; i < 6 - len; i++) {
//		lcd_HD44780_print_char(' ');
//	}
//	lcd_HD44780_print_string(buffer);
//
//	if (hasFirmwareError()) {
//		memcpy(buffer, getFirmwareError(), LCD_WIDTH);
//		buffer[LCD_WIDTH] = 0;
//		lcd_HD44780_set_position(1, 0);
//		lcd_HD44780_print_string(buffer);
//		return;
//	}
//
//	lcd_HD44780_set_position(1, 0);
//	memset(buffer, ' ', LCD_WIDTH);
//	memcpy(buffer, getWarninig(), LCD_WIDTH);
//	buffer[LCD_WIDTH] = 0;
//	lcd_HD44780_print_string(buffer);
//
//	if (engineConfiguration->HD44780height < 3) {
//		return;
//	}
//
//	int index = (getTimeNowSeconds() / 2) % (NUMBER_OF_DIFFERENT_LINES / 2);
//
//	prepareCurrentSecondLine(engine, index);
//	buffer[LCD_WIDTH] = 0;
//	lcd_HD44780_set_position(2, 0);
//	lcd_HD44780_print_string(buffer);
//
//	prepareCurrentSecondLine(engine, index + NUMBER_OF_DIFFERENT_LINES / 2);
//	buffer[LCD_WIDTH] = 0;
//	lcd_HD44780_set_position(3, 0);
//	lcd_HD44780_print_string(buffer);
//
//#if EFI_PROD_CODE
//	dateToString(dateBuffer);
//	lcd_HD44780_set_position(1, 0);
//	lcd_HD44780_print_string(dateBuffer);
//#endif /* EFI_PROD_CODE */
}
Пример #5
0
static void fillWithSpaces(void) {
	int column = getCurrentHD44780column();
	for (int r = column; r < 20; r++) {
		lcd_HD44780_print_char(' ');
	}
}