예제 #1
0
 int main() {
	int column;
	char str[24];
	
	/* Test #1: Initialize LCD screen */
	initLcd();
	_delay_ms(DELAY_COUNT);
	
	
	/* Test #2: Write letter in each cell on screen */
	
	for(column = 0; column < 16; column ++) {
		lcdCursor(1, column+1);
		snprintf(str, sizeof(str), "%X", column);
		lcdString(str);
		_delay_ms(DELAY_COUNT/6);
	}
	
	for(column = 0; column < 16; column ++) {
		lcdCursor(2, column+1);
		snprintf(str, sizeof(str), "%x", column);
		lcdString(str);
		_delay_ms(DELAY_COUNT/6);
	}
	
	/* Test #3: Clear screen */
	
	lcdClear();
	_delay_ms(DELAY_COUNT);
		
	/* Test #4: Write first line */
	
	lcdCursor(1, 1);
	snprintf(str, sizeof(str), "----++++----++++0000");
	lcdString(str);
	_delay_ms(DELAY_COUNT);
	
	/* Test #5: Write second line */
	
	lcdCursor(2, 1);
	snprintf(str, sizeof(str), "AAAABBBBAAAABBBB====");
	lcdString(str);
	_delay_ms(DELAY_COUNT);
	
	return 0;
 }
void lcd_test()
{
    lcdCursor      (lcdHandle, FALSE) ;
    lcdCursorBlink (lcdHandle, FALSE) ;
    lcdClear       (lcdHandle) ;

    lcdPutBigNumber(0, 0, 0);
    lcdPutBigNumber(3, 0, 1);
    lcdPutBigNumber(6, 0, 2);
    lcdPutBigNumber(9, 0, 3);
    lcdPutBigNumber(12, 0, 4);

    waitForEnter () ;

    lcdClear       (lcdHandle) ;

    lcdPutBigNumber(0, 0, 5);
    lcdPutBigNumber(3, 0, 6);
    lcdPutBigNumber(6, 0, 7);
    lcdPutBigNumber(9, 0, 8);
    lcdPutBigNumber(12, 0, 9);

    waitForEnter () ;

    lcdClear       (lcdHandle) ;

    lcdPutBigNumber(0, 0, 0);
    lcdPutBigNumber(4, 0, 1);
    lcdPutBigNumber(8, 0, 2);
    lcdPutBigNumber(12, 0, 3);
    lcdPutBigNumber(16, 0, 4);

    waitForEnter () ;

    lcdClear       (lcdHandle) ;

    lcdPutBigNumber(0, 0, 5);
    lcdPutBigNumber(4, 0, 6);
    lcdPutBigNumber(8, 0, 7);
    lcdPutBigNumber(12, 0, 8);
    lcdPutBigNumber(16, 0, 9);

    waitForEnter () ;

    lcdClear       (lcdHandle) ;

    lcdPutBigSpecialChar(0, 0, ':');

    waitForEnter () ;
}
예제 #3
0
파일: main.c 프로젝트: pe1jpd/23cm
void displayFrequency(long int f)
{
	int i;
	char c;

	hex2bcd(f);

	lcdCursor(4,0);

	for (i=1; i<8; i++) {
		c = str[i];
		if (i==5) {
			lcdChar('.');
		}
		lcdChar(c);
	}
}
 int main() {
	MotorDirection dirs[] = {FORWARD, BACKWARD, RIGHT, LEFT,
			SOFT_RIGHT, SOFT_LEFT, SOFT_RIGHT2, SOFT_LEFT2, STOP};
	char strDirs[9][16] = {"FORWARD", "BACKWARD", "RIGHT", "LEFT",
			"SOFT_RIGHT", "SOFT_LEFT", "SOFT_RIGHT2", "SOFT_LEFT2", "STOP"};

	int idx;
	
	initMotor();
	initLcd();

#if 0
	/* Test #1: Check direction */
	
	motorVelocitySet(255, 255);

	for(idx = 0; idx < (sizeof(dirs)/sizeof(dirs[0])); idx ++) {
		lcdClear();
		lcdCursor(1,1);
		lcdString(strDirs[idx]);
		_delay_ms(DELAY_COUNT*2);
		motorDirectionSet(dirs[idx]);
		
		/* Delay for some time */
		
		_delay_ms(DELAY_COUNT);
				
		motorDirectionSet(STOP);

	}
	
	/* Test #2: Check speed */

	lcdClear();
	lcdCursor(1,1);
	lcdString("Speed : ");
	lcdCursor(2,1);
	lcdString("L 100, R 100");
	_delay_ms(DELAY_COUNT*2);

	motorVelocitySet(100, 100);
	motorDirectionSet(FORWARD);
		
	/* Delay for some time */

	_delay_ms(DELAY_COUNT);
		
	motorDirectionSet(STOP);

	/* Test #3: Check individual wheel speed (L < R) */
	
	lcdClear();
	lcdCursor(1,1);
	lcdString("Speed : ");
	lcdCursor(2,1);
	lcdString("L 100, R 255");
	_delay_ms(DELAY_COUNT*2);

	motorVelocitySet(100, 255);	/* Left turn expected */
	motorDirectionSet(FORWARD);
	
	/* Delay for some time */
	
	_delay_ms(DELAY_COUNT);	
	
	motorDirectionSet(STOP);

	/* Test #4: Check individual wheel speed (L > R) */

	lcdClear();
	lcdCursor(1,1);
	lcdString("Speed : ");
	lcdCursor(2,1);
	lcdString("L 255, R 100");
	_delay_ms(DELAY_COUNT*2);

	motorVelocitySet(255, 100);	/* Right turn expected */
	motorDirectionSet(FORWARD);
	
	/* Delay for some time */
	
	_delay_ms(DELAY_COUNT);
		
	motorDirectionSet(STOP);


	/* Test #5: Check left position encoder */

	motorLeftPositionEncoderInit(leftPosEncoderIsr);
	lPosCount = 100;
	motorVelocitySet(255, 255);
	motorDirectionSet(FORWARD);
#endif

	
	/* Test #6: Check orientation */
	motorLeftPositionEncoderInit(leftPosEncoderIsr);
	lPosCount = 23;
	motorVelocitySet(150, 150);
	motorDirectionSet(LEFT);


	while(1);
	return 0;
 }
 int main() {
	AdcChannel channel[] = {
		ADC_BATTERY_VOLTAGE,
		ADC_WHITE_LINE1,
		ADC_WHITE_LINE2,
		ADC_WHITE_LINE3,
		ADC_IR_PROXIMITY1,
		ADC_IR_PROXIMITY2,
		ADC_IR_PROXIMITY3,
		ADC_IR_PROXIMITY4,
		ADC_IR_PROXIMITY5,
		ADC_IR_RANGE1,
		ADC_IR_RANGE2,
		ADC_IR_RANGE3,
		ADC_IR_RANGE4,
		ADC_IR_RANGE5,
		ADC_SERVO_POD1,
		ADC_SERVO_POD1,
		ADC_LAST
	};

	char strChannel[17][20] = {
		"ADC_BATTERY_VOLTAGE",
		"ADC_WHITE_LINE1",
		"ADC_WHITE_LINE2",
		"ADC_WHITE_LINE3",
		"ADC_IR_PROXIMITY1",
		"ADC_IR_PROXIMITY2",
		"ADC_IR_PROXIMITY3",
		"ADC_IR_PROXIMITY4",
		"ADC_IR_PROXIMITY5",
		"ADC_IR_RANGE1",
		"ADC_IR_RANGE2",
		"ADC_IR_RANGE3",
		"ADC_IR_RANGE4",
		"ADC_IR_RANGE5",
		"ADC_SERVO_POD1",
		"ADC_SERVO_POD2",
		"ADC_LAST"
	};

	char buf[17];
	UINT value, idx;

	initAdc();
	initLcd();
	
	for(idx = 0; idx < (sizeof(channel)/sizeof(channel[0])); idx ++) {
		lcdClear();
		lcdCursor(1,1);
		lcdString(strChannel[idx]);
		lcdCursor(2,1);

		if(getAdcValue(channel[idx], &value) == STATUS_OK) {
			snprintf(buf, sizeof(buf), "%d", value);
			lcdString(buf);
		}
		else {
			lcdString("Error");
		}
		_delay_ms(DELAY_COUNT);
	}
	

	return 0;
 }
예제 #6
0
int main (int argc, char *argv[])
{
  int i ;
  int lcd ;
  int bits, rows, cols ;

  struct tm *t ;
  time_t tim ;

  char buf [32] ;

  if (argc != 4)
    return usage (argv [0]) ;

  printf ("Raspberry Pi LCD test\n") ;
  printf ("=====================\n") ;

  bits = atoi (argv [1]) ;
  cols = atoi (argv [2]) ;
  rows = atoi (argv [3]) ;

  if (!((rows == 1) || (rows == 2) || (rows == 4)))
  {
    fprintf (stderr, "%s: rows must be 1, 2 or 4\n", argv [0]) ;
    return EXIT_FAILURE ;
  }

  if (!((cols == 16) || (cols == 20)))
  {
    fprintf (stderr, "%s: cols must be 16 or 20\n", argv [0]) ;
    return EXIT_FAILURE ;
  }

  wiringPiSetup () ;

  if (bits == 4)
    lcdHandle = lcdInit (rows, cols, 4, 11,10, 4,5,6,7,0,0,0,0) ;
  else
    lcdHandle = lcdInit (rows, cols, 8, 11, 10, 0,1,2,3,4,5,6,7) ;

  if (lcdHandle < 0)
  {
    fprintf (stderr, "%s: lcdInit failed\n", argv [0]) ;
    return -1 ;
  }

  lcdPosition (lcdHandle, 0, 0) ; lcdPuts (lcdHandle, "Gordon Henderson") ;
  lcdPosition (lcdHandle, 0, 1) ; lcdPuts (lcdHandle, "  wiringpi.com  ") ;

  waitForEnter () ;

  if (rows > 1)
  {
    lcdPosition (lcdHandle, 0, 1) ; lcdPuts (lcdHandle, "  wiringpi.com  ") ;

    if (rows == 4)
    {
      lcdPosition (lcdHandle, 0, 2) ;
      for (i = 0 ; i < ((cols - 1) / 2) ; ++i)
        lcdPuts (lcdHandle, "=-") ;
      lcdPuts (lcdHandle, "=3") ;

      lcdPosition (lcdHandle, 0, 3) ;
      for (i = 0 ; i < ((cols - 1) / 2) ; ++i)
        lcdPuts (lcdHandle, "-=") ;
      lcdPuts (lcdHandle, "-4") ;
    }
  }

  waitForEnter () ;

  lcdCharDef  (lcdHandle, 2, newChar) ;

  lcdClear    (lcdHandle) ;
  lcdPosition (lcdHandle, 0, 0) ;
  lcdPuts     (lcdHandle, "User Char: ") ;
  lcdPutchar  (lcdHandle, 2) ;

  lcdCursor      (lcdHandle, TRUE) ;
  lcdCursorBlink (lcdHandle, TRUE) ;

  waitForEnter () ;

  lcdCursor      (lcdHandle, FALSE) ;
  lcdCursorBlink (lcdHandle, FALSE) ;
  lcdClear       (lcdHandle) ;

  for (;;)
  {
    scrollMessage (0, cols) ;
    
    if (rows == 1)
      continue ;

    tim = time (NULL) ;
    t = localtime (&tim) ;

    sprintf (buf, "%02d:%02d:%02d", t->tm_hour, t->tm_min, t->tm_sec) ;

    lcdPosition (lcdHandle, (cols - 8) / 2, 1) ;
    lcdPuts     (lcdHandle, buf) ;

    if (rows == 2)
      continue ;

    sprintf (buf, "%02d/%02d/%04d", t->tm_mday, t->tm_mon + 1, t->tm_year+1900) ;

    lcdPosition (lcdHandle, (cols - 10) / 2, 2) ;
    lcdPuts     (lcdHandle, buf) ;

    pingPong (lcd, cols) ;
  }

  return 0 ;
}
예제 #7
0
int main(int argc, char *argv[]) {
  struct tm *t;
  time_t tim;
  char buf[32];

  const char* programName = argv[0];
  const char* displayMessage = argv[1];

  if(argc < 2) {
    fprintf(stderr, "Usage: %s display_message\n", programName);
    return -1;
  }

  /* initialize WiringPi */
  wiringPiSetupSys();

  /* initalize LCD */
  lcdHandle = lcdInit(ROWS, COLUMNS, 4, AF_RS, AF_E, AF_D1, AF_D2, AF_D3, AF_D4, 0, 0, 0, 0);
  if(lcdHandle < 0) {
    fprintf(stderr, "lcdInit failed\n");
    return -1;
  }

  /* initalize PCF8574 module, NOTE that the device address must be right & can be acquired by "i2cdetect -y 1" command */
  pcf8574Setup(AF_BASE, 0x3f);

  /* turn on LCD backlight */
  pinMode(AF_BL, OUTPUT);
  digitalWrite(AF_BL, 1);

  /* set LCD into write mode */
  pinMode(AF_RW, OUTPUT);
  digitalWrite(AF_RW, 0);

  /* then we start to display various messages on the LCD screen */
  lcdClear(lcdHandle);             // clear the screen
  lcdPosition(lcdHandle, 3, 0);    // set the cursor on the the 4th column & 1st row
  lcdPuts(lcdHandle, "RPi");       // print the text on the LCD at current cursor postion
  lcdPosition(lcdHandle, 4, 1);    // set the cursor on the the 5th column & 2nd row
  lcdPuts(lcdHandle, "codelast");

  waitForEnter();

  lcdClear(lcdHandle);             // clear the screen
  lcdPosition(lcdHandle, 0, 0);    // set the cursor on the 1st column & 1st row
  lcdCursor(lcdHandle, true);      // turn the cursor on
  lcdCursorBlink(lcdHandle, true); // turn the cursor blink on

  waitForEnter();

  lcdCursor(lcdHandle, false);       // turn the cursor off
  lcdCursorBlink(lcdHandle, false);  // turn the cursor blink off
  lcdClear(lcdHandle);               // clear the screen
  lcdPuts(lcdHandle, "Will scroll...");

  waitForEnter();

  while(true) {
    scrollMessage(0, COLUMNS, displayMessage);  // scroll the specified message on the 1st row

    /* display current time on LCD */
    tim = time(NULL);
    t = localtime(&tim);
    sprintf(buf, "%02d:%02d:%02d", t->tm_hour, t->tm_min, t->tm_sec);

    lcdPosition(lcdHandle, (COLUMNS - 8) / 2, 1);
    lcdPuts(lcdHandle, buf);
  }
  
  return 0;
}
예제 #8
0
파일: demo1.c 프로젝트: Iryaz/leso6
int main() {
	//! Инициализация портов для светодиодов.
	DDRF |= (1 << DDF0 | 1 << DDF1 | 1 << DDF2 | 1 << DDF3);
	//! Инициализация порта для пьезоизлучателя.
	DDRB |= (1 << DDB0);
	//! Инициализация портов для строк клавиатуры. Строки на ввод.
	DDRD &= ~(1 << DDD4 | 1 << DDD5 | 1 << DDD6 | 1 << DDD7);
	//! Инициализация портов для строк клавиатуры. Поддяжка к питанию.
	PORTD |= (1 << PD4 | 1 << PD5 | 1 << PD6 | 1 << PD7);
	//! Инициализация портов для столбцоы клавиатуры. столбцы на вывод.
	DDRG |= (1 << DDG0 | 1 << DDG1 | 1 << DDG2);

	//! Инициализация таймера для излучателя звука.
	TCCR3A = 0;
	TCCR3A = 0;
	TCCR3B = 0;
	TCCR3B_struct.cs3 = 0x01;		// Предделитель: F_CPU/1
	TIMSK3_struct.toie3 = 1;		// Разрешаем прерывание по переполнению
	TCNT3 = -8000;					// 8000 тактов центрального проессора ~ 500 мкс.

	//! Инициализация таймера для смены режимов.
	TCCR4A = 0;
	TCCR4A = 0;
	TCCR4B = 0;

	uint8_t key1, key2 = 0;			//!< Переменные для хранения кода нажатых клавишь.
	uint8_t i;
	char tx_buff_str[16];


	//! Структура для чтения времени.
	//! Перед первым использованием должна быть инициализирована.
	ds18b20_memory_t ds18b20_memory = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	int16_t temper = 0;

	//! Структура для чтения времени.
	//! Перед первым использованием должна быть инициализирована.
	rtc_data_r_t time = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	//rtc_data_w_t time_w = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //!< Структура для установки времени.
	uint8_t sec;

	I2C_Master_Initialise(); 			//!< Инициализация I2C интерфейса.
	ds18b20_convert();					//!< Запуск преобразование температуры.
	uart_init();						//!< Инициализируем UART.
	uart_set_input_cb(uart_rx_cb);// Устанавливаем функцию обратного вызова на прием байта по UART.

	printf("\n\rLESO laboratory (c) 2014\r\nDemo test program\r\n");
	printf("LESO6 ATMEGA128RFA1\r\n");
	fprintf(stderr, "stderr: NO ERRORS\r\n");

	//! Массив с описанием символа градуса.
	uint8_t ch[8] = {
	0x06, /*x x x 0 0 1 1 0*/
	0x09, /*x x x 0 1 0 0 1*/
	0x09, /*x x x 0 1 0 0 1*/
	0x06, /*x x x 0 0 1 1 0*/
	0x00, /*x x x 0 0 0 0 0*/
	0x00, /*x x x 0 0 0 0 0*/
	0x00, /*x x x 0 0 0 0 0*/
	0x00  /*x x x 0 0 0 0 0*/
	};

	//! Управлящая структура для ЖКИ.
	lcd_t lcd = { 0, 0, 0, 0, 0 };
	lcdInit(&lcd);								//!< Инициализируем ЖКИ;
	lcdCursor(&lcd, 0);							//!< Выключаем курсор.
	lcdCursorBlink(&lcd, 0);					//!< Выключаем мерцание курсора.
	sprintf(tx_buff_str, " LESO6 \n 2014%c  ", 0xb4);
	lcdPuts(&lcd, tx_buff_str);
	lcdCharDef(&lcd, 1, ch);					//!< Определяем новый символ.

	for (i = 0; i < 75; i++)
		_delay_ms(10);
	getTimeDS1338(&time);						//!< Читаем время.
	ds18b20_read(&ds18b20_memory);				//!< Читаем температуру.
	sec = time.Second;

	TIMSK3_struct.toie3 = 0;// Запрещаем прерывание при переполнении таймера 3.
	off(BIP);									// Выключаем звук.

	lcdClear(&lcd);
	lcdCursor(&lcd, 1);
	lcdPuts(&lcd, "Text:\n");
	while (1) {
		while (key_mode)		// В режиме набора текст:
		{
			key1 = getKeyChar();
			for(i=0; i<5; i++) _delay_ms(10);
			key2 = getKeyChar();

			if (key1 == '\n') continue;
			else if (key1 != key2) continue;

			TCNT4 = 0;				// Дополнительное время работы в этом режиме
			if((lcd.cx) == lcd.cols)// закончились символы в строке
			{
				lcdPuts(&lcd,"\r        \r");// стираем строку, возвращаем курсор в начало
				printf("\r\033[0K");// стираем строку в терминале
			}
			lcdPutchar(&lcd, key1);
			LEDS &= ~0x0F;
			LEDS |= 0x0F&key1;
			putchar(key1);
			TIMSK3_struct.toie3 = 1;			// пик
			for(i=0; i<20; i++) _delay_ms(10);
			TIMSK3_struct.toie3 = 0;
		}

		printf("\r\033[0K%02u:%02u:%02u",time.Hour, time.Minute ,time.Second);
		sprintf(tx_buff_str, "%02u:%02u:%02u\n",time.Hour, time.Minute ,time.Second);
		lcdHome(&lcd);
		lcdPuts(&lcd, tx_buff_str);

		if(ds18b20_crc8((uint8_t *)&ds18b20_memory, sizeof(ds18b20_memory)))
		fprintf(stderr,"ERROR read DS18B20\r\n");
		else
		{
			temper = (ds18b20_memory.temper_MSB << 8) | ds18b20_memory.temper_LSB;
			printf(" T= %d.%u",temper>>4, ((temper&0xf)*1000)/(16));
			sprintf(tx_buff_str,"%02d.%u%cC  ",temper>>4, ((temper&0xf)*1000)/(16), 0x01);
			lcdPuts(&lcd, tx_buff_str);
		}

		ds18b20_convert();		// Запуск преобразование температуры.
		while(sec == time.Second)
		{
			if (getTimeDS1338(&time))
			{
				fprintf(stderr,"ERROR: read date fail..!\n\r");
				continue;
			}

			key1 = getKeyChar();
			if (key1 != '\n')
			{
				key_mode = 1;
				lcdClear(&lcd);
				lcdCursor(&lcd, 1);
				lcdPuts(&lcd,"Text:\n");

				TCCR4B_struct.cs4 = 0x04;		// Предделитель: F_CPU/256
				TIMSK4_struct.toie4 = 1;// Разрешаем прерывание по переполнению
				TCNT4 = 0;
				printf("\r\033[0K");// стираем строку в терминале
				break;
			}
			for(i=0; i<20; i++) _delay_ms(10);
		}
		sec = time.Second;
		ds18b20_read(&ds18b20_memory);
		if(ds18b20_crc8((uint8_t *)&ds18b20_memory, sizeof(ds18b20_memory)))
		fprintf(stderr,"ERROR read DS18B20\r\n");
	}

	return 0;
}
예제 #9
0
파일: main.c 프로젝트: pe1jpd/23cm
int main()
{
	// PORTB output for LCD
	DDRB = 0xff;
	PORTB = 0xff;

#ifdef BOARD2
	// PORTC PC0-4 output, PC5 input
	DDRC = 0x1f;
	PORTC = 0x00;
	sbi(PORTC, MUTE);
#endif
#ifdef BOARD1
	// PORTC PC0,2-5 output, PC1 input
	DDRC = 0x3d;
	PORTC = 0x00;
	sbi(PORTC, MUTE);
#endif

	// PORTD is input with pullup
	DDRD = 0x00;
	PORTD = 0xff;

	lcdInit();
	adcInit();

	readGlobalSettings();
	toneCount = 5*F_CPU/tone;

	initInterrupts();
    initPLL();

	sprintf(str, "PE1JPD 23cm v%s", version);
	lcdCursor(0,0);
	lcdStr(str);
	_delay_ms(500);

	for (;;) {
		switch(mode) {
			case VFO:
				mode = Vfo();
				writeGlobalSettings();
				break;
			case MEMORY:
				mode = Memory();
				writeGlobalSettings();
				break;
			case SPECTRUM:
				mode = Spectrum();
				break;
			case MENU:
				mode = Menu(mode);
				break;
			case MEMORY_MENU:
				mode = MemoryMenu(mode);
				break;
			default:
				mode = VFO;
				break;
		}
	}
}
예제 #10
0
파일: main.c 프로젝트: pe1jpd/23cm
int rxtx()
{
	int s;

	// read ptt on PORTD
	int c = PIND;

	// listen reverse?
	if (rv) {
		if (c & (1<<REVERSE)) {
			lastFreq = 0;
			rv = FALSE;
		}
	}
	else {
		if (!(c & (1<<REVERSE))) {
			lastFreq = 0;
			rv = TRUE;
		}
	}

	if (tx) {
		//keep smeter clear
		s = 0;
		// switch from tx to rx??
		if (c & (1<<PTT) ) {
			cbi(PORTC, TXON);
			lastFreq = 0;
			tx = FALSE;
		}
	}
	else {
		s = readRSSI();
		displaySmeter(s);

		// switch from rx to tx?
		if (!(c & (1<<PTT) )) {
			// clear smeter
			s = 0;
			displaySmeter(s);
			sbi(PORTC, MUTE);
			sbi(PORTC, TXON);
			// force update pll
			lastFreq = 0;
			tx = TRUE;
		}
	}

	// calc value for ISR
	toneCount = 5*F_CPU/tone;

	// freq change or update needed?
	if (freq != lastFreq) {
		long int f = freq;
		if (tx) {
			f += (long int) shift*1000;
			setFrequency(f);
		}
		else {
			if (rv) f += (long int)shift*1000;
			setFrequency(f - IF);
		}
		displayFrequency(f);
		lastFreq = freq;
		lcdCursor(15,0);
		if (tx)
			lcdChar('T');
		else
			lcdChar('R');
	}

	return s;
}
예제 #11
0
파일: editlcd.c 프로젝트: lucidm/i2lcd
/**
 * Open main editor interface windows
 */
void openEditor(struct options_values *options, struct editor *e)
{
    char title[100];
    int i;
    struct panelw *p0, *p1, *p2;
    FIELD *f[2];

    openI2LCD2(&e->lcd, options->bus, options->address, options->columns, options->rows);
    lcdPower(&e->lcd, POWERON);
    lcdSetBacklight(&e->lcd, 0x3f);
    lcdSetContrast(&e->lcd, 0x17);
    lcdBlink(&e->lcd, 1);
    lcdCursor(&e->lcd, 1);
    lcdClear(&e->lcd);

    lcdPrintf(&e->lcd, "LCDEd v1.0\x01");

    e->brght = 0x3f;
    e->contr = 0x17;

    snprintf(title, 100, "LCD %dx%d:", e->lcd.cols, e->lcd.rows);

    p0 = openWindow(1, 1,
               e->lcd.cols, e->lcd.rows, COLOR_PAIR(1),
               title, "LCD Content editor\n"
                                 "\tCursor keys to move cursor around\n"
                                 "\t'PgUp'\tmoves cursor to the top row\n"
                                 "\t'PgDown'\tmoves cursor to the bottom row\n"
                                 "\t'Home'\tmoves cursor to the first column in row\n"
                                 "\t'End'\tmoves cursor to the last column in row\n\n"
                                 "\t'F1'\tto clear LCD screen\n"
                                 "\t'F3'/'F4'\tto decrease/increase contrast\n"
                                 "\t'F5'/'F6'\tto decrease/increase brightness\n",
	       lcdWindowHandler, lcdActivateHandler);
    lcdSetCursor(&e->lcd, p0->col, p0->row);
    p0->lcd = &e->lcd;

    p1 = openWindow((p0->x + (p0->width < 20 ? 20 : p0->width)) + 1, 1,
               5, 8, COLOR_PAIR(1),
               "C-1:", "Graphic character editor\n"
                       "\tCursor keys to move cursor around\n"
                       "\t'Space' to toggle pixel under the cursor\n"
                       "\t'PgUp'\tPrevious character\n"
                       "\t'PgDown'\tNext character\n"
                       "\t'F1'\tto wipe character\n"
                       "\t'F2'\tto reverse colors\n"
                       "\t'S'\tTo save GC to header file\n",
               gcWindowHandler, gcActivateHandler);
    p1->lcd = &e->lcd;
    p1->gcn = 0;

    p2 = openWindow((p1->x + p1->width), 1,
               2, 8, COLOR_PAIR(3),
               "Hex",  "Hex editor for graphic character\n"
                       "\tCursor keys to move cursor around\n"
                       "\tSet value 0-f for value under cursor\n"
                       "\t'PgUp'\tPrevious character\n"
                       "\t'PgDown'\tNext character\n"
                       "\t's'\tTo save GC to header file\n",
               gchWindowHandler, NULL);
    p2->lcd = &e->lcd;

    e->_actw = p0;

    joinWindows(p0, p1);
    joinWindows(p1, p2);
    joinWindows(p2, p0);

    e->potss = openWindow(p0->x, p0->y + p0->height + 1, 20, 3, COLOR_PAIR(3), "Potentiometers:", "", NULL, NULL);

    mvwprintw(e->potss->win, 1, 1, "Brightness:\t0x%02X", e->brght);
    mvwprintw(e->potss->win, 2, 1, "Contrast:\t0x%02X", e->contr);
    refresh();

}