예제 #1
0
파일: main.c 프로젝트: BillyZhangZ/wifi
void lcd_task
(
        uint32_t initial_data
)
{
    DATE_STRUCT      time_rtc;
    uint32_t         time;
    TIME_STRUCT      ts;
    eLCD_Symbols     spec_sym;
    char             time[5];
    char             state = 0;

    puts("\n\n");
    if (_lcd_init() == IO_ERROR)
    {
        puts("_lcd_init() function returned IO_ERROR\n");
        puts("lcd_task blocked\n\n");
        _task_block();
    }

    puts("TWRPI-SLCD display is connected and lcd_task is running\n");

    _lcd_segments( FALSE );
    while(1)
    {
        _rtc_get_time(&time);
        ts.SECONDS = time;
        ts.MILLISECONDS = 0;
        _time_to_date(&ts, &time_rtc);

        /* post meridiem */
        if( time_rtc.HOUR > 12 )
        {
            time_rtc.HOUR -= 12;
            spec_sym = LCD_AM;
            _lcd_symbol( spec_sym, FALSE );
            spec_sym = LCD_PM;
            _lcd_symbol( spec_sym, TRUE);
        }
        else
        {
            spec_sym = LCD_PM;
            _lcd_symbol( spec_sym, FALSE);
            spec_sym = LCD_AM;
            _lcd_symbol( spec_sym, TRUE);
        }
        sprintf( time, "%2d%2d", time_rtc.HOUR, time_rtc.MINUTE);
        if( time_rtc.MINUTE < 10 )
        {
            time[2] = '0';
        }
        _lcd_puts( time );
        spec_sym = LCD_COL1;
        state = (state + 1) & 1;
        _lcd_symbol( spec_sym, (bool)state );
        _time_delay(1000);
    } /* Endwhile */
} /* Endbody */
예제 #2
0
파일: lcdoutc.c 프로젝트: alpha-it/u-boot
int lcd_probe(void)
{
	pDev = (lcd_dev_t *)malloc(sizeof(lcd_dev_t));
	if (!pDev) {
		printf("[tcon]: Not enough memory.\n");
		return -1;
	}
	pDev->lcd_info.mode =  lcd_outputmode();
	pDev->conf = lcd_config;
	_lcd_init(&pDev->conf);
	return 0;
}
예제 #3
0
파일: lcd.c 프로젝트: plumbum/easyface
void lcdInit(void)
{
    _lcd_init();

    lcdPrepareWrite();
    CMD_SLEEP_MS(16); // 16 ms

    lcdWriteData(3); // 8bit mode
    pulse_e();
    CMD_SLEEP_MS(5); // 4992 us

    pulse_e(); // Repeat 8bit mode
    CMD_SLEEP_MS(1); // 64 us

    pulse_e(); // Third repeat
    CMD_SLEEP_MS(1); // 64 us

    // lcdWriteData(2); // Change to 4bit mode (0x20)
    // pulse_e();

    lcdCmd(LCD_CMD_INIT8);
    /*
    lcdCmd(0x24);
    lcdCmd(0x09);
    lcdCmd(0x20);
    */

    lcdCmd(0x08);
    lcdCmd(0x01);
    lcdCmd(0x06);
    lcdCmd(0x0C);

    lcdCmd(0x80);
    /*
    lcdCmd(0x02);
    */
    /*
    lcdCmd(LCD_SET_DM | LCD_DM_DISPLAY_ON);
    lcdCmd(LCD_SET_INCREMENT_MODE);
    */

#ifdef WRAPEN
    cur_col = 0;
    cur_row = 0;
#endif
}
예제 #4
0
/** LCD 8 bits mode */
void _lcd_pins(u8 rs, u8 enable, u8 d0, u8 d1, u8 d2, u8 d3, u8 d4, u8 d5, u8 d6, u8 d7)
{
	_lcd_init(((d4 + d5 + d6 + d7)==0), rs, -1, enable, d0, d1, d2, d3, d4, d5, d6, d7);		
}