static void idle(bool is_idle) { static int idle_time = 0; static bool was_idled = false; if (is_idle) { if (!was_idled) { if (++idle_time == MAX_IDLE_TIME) { was_idled = true; #ifdef CYGSEM_IPAQ_LCD_COMM lcd_on(false); #endif } } } else { idle_time = 0; if (was_idled) { was_idled = false; #ifdef CYGSEM_IPAQ_LCD_COMM lcd_on(true); #endif } } }
int main(void) { int x, y; char c; char custom_char[] = {0x01, 0x03, 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x1F}; lcd_init(); lcd_on(); c = 0x1F; lcd_custom_char(0, custom_char); while(1){ for(y = 0; y < 2; y++) { c++; if(c > 0xFE) c = 0x1F; for(x = 0; x < 16; x++) { lcd_moveto(x,y); //lcd_write(c); lcd_write(0x00); } } //lcd_clear(); _delay_ms(500); } return 0; /* never reached */ }
int main() { init_com(); init_lcd_hardware(); g_clear_screen(); draw_color = PIXEL_ON; /* uint16_t xc = 0, yc = 0; for (xc = 0; xc < 40; xc += 8) for (yc = 0; yc < 240; yc += 64) copy_logo(yc, xc); */ sei(); lcd_on(); while (1) { if (activate_hypnotoad_flag) { activate_hypnotoad_flag = 0; g_clear_screen(); hypnotoad(); } handle_com(); } }
void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT double alpha = .5; double x_avg = 0; double y_avg = 0; volatile short x_pos = 0; volatile short y_pos = 0; char buffer[40]; int count = 0; clock_init(); lcd_on(); init_xy_display(); BCSCTL3 |= LFXT1S_2; // LFXT1 = VLO IFG1 &= ~OFIFG; // Clear OSCFault flag BCSCTL2 |= SELM_0 + DIVM_3 + DIVS_3; // MCLK = DCO/8 while(1) { count++; read_xy_calc_avg(&x_avg, &y_avg, alpha); if (!(count % 2)) printXY(buffer, (int)x_avg, (int)y_avg); } }
void lcd_init() { // Setup all lcd pins as outputs LCD_CONTROL_DDR |= _BV(LCD_RS_PIN) | _BV(LCD_E_PIN); LCD_DATA_DDR |= _BV(LCD_DATA0_PIN) | _BV(LCD_DATA1_PIN) | _BV(LCD_DATA2_PIN) | _BV(LCD_DATA3_PIN); // Wait for the module _delay_ms(200); // To be safe switch back to 8-bit interface for a moment (Function Set) LCD_CONTROL_PORT &= ~_BV(LCD_RS_PIN) & ~_BV(LCD_E_PIN); LCD_RST_DATA; LCD_DATA_PORT |= _BV(LCD_DATA0_PIN) | _BV(LCD_DATA1_PIN); lcd_strobe(); _delay_ms(10); lcd_strobe(); _delay_ms(10); lcd_strobe(); _delay_ms(10); // Function Set: switch to 4 bit mode (last 8-bit command) LCD_RST_DATA; LCD_DATA_PORT |= _BV(LCD_DATA1_PIN); lcd_strobe(); _delay_ms(10); // Using 4 bit mode now. Repeat Function Set command (2 lines, 5x8 chars, 4-bit mode) lcd_cmd(0x28); lcd_off(); lcd_clr(); lcd_cmd(LCD_CMD_DEFAULT_MODE); lcd_on(); }
void init_graphics2() { memset((void *)(0x90000000), 0, my_lcd_config.virtual_xres * my_lcd_config.virtual_yres * my_lcd_config.pixelsize / 8); lcd_on(); init_gdi_driver(&my_lcd_config); SetLCD_Conf(&my_lcd_config); InitDriver(); setDevice(1); //change gotoXY(0,0); };
void lcd_enable(void) { /* 使能LCD本身 */ lcd_on(); /* 打开背光 */ backlight_enable(); /* 使能display controller */ displaycon_on(); }
void lcd_init(void) { LCD_CTRL_PORT &= ~LCD_CTRL_MASK; LCD_CTRL_DDR |= LCD_CTRL_MASK; _delay_ms(20); lcd_prepare_write(0); lcd_write_nibble(0x3); _delay_us(40); lcd_write_nibble(0x3); _delay_us(40); lcd_write_nibble(0x3); _delay_us(40); lcd_write_nibble(0x2); _delay_us(40); lcd_write(0, 0x28); _delay_us(40); lcd_on(0); lcd_clear(); lcd_set_entry_mode(LCD_MODE_ID); lcd_on(LCD_ON_DISPLAY | LCD_ON_BLINK); lcd_init_hints(); }
static void system_init(void) { delay_init(); led_init(); beep_init(); key_init(); uart_init(); lcd_init(); sram_init(); time_init(); flash_inside_init(); flash_outside_init(); led_power_on(); lcd_on(); }
void main() { int i; ANSEL = 0x00; TRISA = 0xFF; TRISB = 0x7F; // Initialize lcd driver lcd_init(0, 16, 2); // Load characters to CGRAM lcd_create_char(0, arrowr); lcd_create_char(1, arrowu); lcd_create_char(2, arrowl); lcd_create_char(3, arrowd); // Clear screen to end write to character generator lcd_clear(); // Turn on display lcd_on(); // Display message on the first row lcd_puts(" geekfactory.mx "); // Move cursor to the fourth column on second line lcd_goto(3, 1); // Print a message there lcd_puts("Hello World"); // Mover cursor to the sixteenth column on second row lcd_goto(15, 1); // Main loop for (;;) { for (i = 0; i < 4; i++) { // 1 Hz led blink delay_ms(500); // Toggle pin RB7 PORTB ^= 0x80; // Write custom defined character code (can be 0-7) lcd_write(i); // Goto the last visible position on the screen lcd_goto(50, 50); } } }
static void lcd_test(int depth) { int i, j; diag_printf("Set depth %d\n", depth); lcd_on(depth); lcd_clear(); for (j = 0; j < 5; j++) { for (i = 0; i < width; i++) { lcd_putc('A'); } } lcd_putc('\n'); lcd_putc('\n'); cyg_thread_delay(5*100); for (j = 0; j < 5; j++) { for (i = FIRST_CHAR; i <= LAST_CHAR; i++) { lcd_putc(i); } } cyg_thread_delay(5*100); }
/** * Implementación de la funcionalidad principal del programa */ void main() { //OSCCON = 0x6C; // Para usar el oscilador interno PIC16F88 4 Mhz OSCCON = 0x7C; // Para usar el oscilador interno PIC16F88 8 Mhz ANSEL = 0x00; // Configuracion de pines analogicos y digitales TRISA = 0xE0; TRISB = 0xFF; // Preparamos las librerías para su uso lcd_init(0, 16, 2); // Iniciar el controlador de pantalla tick_init(); // Iniciar el contador / temporizador del sistema dhtlib_init(); // Preparar la comunicación con el sensor DHT11 // Encendemos la pantalla LCD y escribimos titulo lcd_on(); lcd_puts(" PRUEBA DHT11 "); // Ciclo principal de nuestra aplicación for (;;) { led_task(); dht11_task(); } }
void lcd_test(void) { unsigned char c; static int lcdon = 0; static int blon = 0; static int dispon = 0; lcd_init(); while (1) { printf("********LCD TEST MENU********\n\r"); printf("[L] enable/disable LCD\n\r"); printf("[B] enable/disable back light\n\r"); printf("[C] enable/disable s3c6410 display controller\n\r"); printf("[D] display color\n\r"); printf("[Q] quit\n\r"); do { c = getc(); if (c == '\n' || c == '\r') { printf("\n\r"); } else { putc(c); } } while (c == '\n' || c == '\r'); switch (c) { case 'l': case 'L': { if (lcdon) { lcd_off(); printf("LCD off\n\r"); } else { lcd_on(); printf("LCD on\n\r"); } lcdon = !lcdon; break; } case 'b': case 'B': { if (blon) { backlight_disable(); printf("Backlight off\n\r"); } else { backlight_enable(); printf("Backlight on\n\r"); } blon = !blon; break; } case 'c': case 'C': { if (dispon) { displaycon_off(); printf("Display controller off\n\r"); } else { displaycon_on(); printf("Display controller on\n\r"); } blon = !blon; break; } case 'd': case 'D': { display_red(); break; } case 'q': case 'Q': { return ; break; } } } }
int main (void) { FRESULT rc; /* Result code */ DIR dir; /* Directory object */ FILINFO fno; /* File information object */ unsigned long br, i; alt_u32* active_buff; printf("System started\r\n"); lcd_off(); for(i=0;i<5000000;i++){} alt_sgdma_dev *dma = alt_avalon_sgdma_open("/dev/sgdma"); printf("open dma returned %ld\n", (alt_u32)dma); printf("framebuffer 1 at %lx\n", (alt_u32)frameBufferA); printf("framebuffer 2 at %lx\n", (alt_u32)frameBufferB); active_buff = frameBufferA; //printf("framebuffer 1 at %lx\n", (alt_u32)active_buff); printf("Turning LCD on \r\n"); lcd_on(); printf("Starting DMA\r\n"); init_and_start_framebuffer(dma); IoInit(); Color col2; col2.color32 = 0x00ff0000; memset(frameBufferA, col2.color32, 522240/4); f_mount(0, &Fatfs); /* Register volume work area (never fails) */ for (;;) { printf("\nOpen root directory.\n"); rc = f_opendir(&dir, ""); if (rc) die(rc); printf("\nDirectory listing...\n"); for (;;) { rc = f_readdir(&dir, &fno); /* Read a directory item */ if (rc || !fno.fname[0]) break; /* Error or end of dir */ if (fno.fattrib & AM_DIR) printf(" <dir> %s\n", fno.fname); else { printf("%8lu %s\n", fno.fsize, fno.fname); //printf("\nOpen an existing file.\n"); rc = f_open(&Fil, fno.fname, FA_READ); if (rc) die(rc); if (active_buffer == 0) { active_buffer = 1; active_buff = frameBufferA; } else { active_buff = frameBufferB; active_buffer = 0; } for (;;) { rc = f_read(&Fil, (alt_u32*)active_buff, f_size(&Fil), &br); /* Read a chunk of file */ if (rc || !br) break; /* Error or end of file */ } if (rc) die(rc); rc = f_close(&Fil); if (rc) die(rc); } } if (rc) die(rc); } }
int main(int argc, char **argv) { int fd; // ,fd_sec; int pa,col,i; //lcd_pixel pix; if((fd = open("/dev/dbox/lcd0",O_RDWR)) < 0){ perror("LCD: "); return -1; } lcd_init(fd); return 0; print_status(fd); /* pix.v = 2; for (i=0;i<0xFFFF;i++) { while ( (pix.x=(random()&0xFF)) >= LCD_COLS ); while ( (pix.y=(random()&0xFF)) >= (LCD_ROWS*8) ); if ( ioctl(fd,LCD_IOCTL_SET_PIXEL,&pix) < 0 ) perror(""); } // return 0; */ lcd_on(fd,0); sleep(1); lcd_on(fd,1); sleep(1); lcd_eon(fd,1); sleep(1); lcd_eon(fd,0); sleep(1); lcd_reverse(fd,1); sleep(1); lcd_reverse(fd,0); sleep(1); lcd_bias(fd,0); sleep(1); lcd_bias(fd,1); sleep(1); lcd_adc(fd,0); sleep(1); lcd_adc(fd,1); sleep(1); lcd_shl(fd,1); sleep(1); lcd_shl(fd,0); // TODO: IDL // TODO: SRV for(i=0;i<=7;i++) { lcd_powerc(fd,i); sleep(1); } for(i=0;i<=7;i++) { lcd_res(fd,i); sleep(1); } for(i=0;i<=3;i++) { lcd_sir(fd,i); sleep(1); } for(i=0;i<=0x3f;i++) { lcd_srv(fd,i); sleep(1); } // spage // scolumn return 0; i=LCD_MODE_BIN; if ( ioctl(fd,LCD_IOCTL_ASC_MODE,&i) < 0 ) perror(""); i=LCD_MODE_ASC; if ( ioctl(fd,LCD_IOCTL_ASC_MODE,&i) < 0 ) perror(""); col=0; if ( ioctl(fd,LCD_IOCTL_SCOLUMN,&col) < 0 ) perror(""); for(pa=0;pa<LCD_ROWS;pa++) { col=0; if ( ioctl(fd,LCD_IOCTL_SCOLUMN,&col) < 0 ) perror(""); if ( ioctl(fd,LCD_IOCTL_SPAGE,&pa) < 0 ) perror(""); // if ( ioctl(fd,LCD_IOCTL_SET_ADDR,&col) < 0 ) // perror(""); // lcd_set_pos( pa, 0 ); i=pa; for(col=0;col<LCD_COLS;col++) { // i=~i; printf("%d - %d\n",pa,col); if ( ioctl(fd,LCD_IOCTL_WRITE_BYTE,&i) < 0 ) perror(""); // sleep(1); // lcd_write_byte( *bp ); } } if ( ioctl(fd,LCD_IOCTL_WRITE_BYTE,&i) < 0 ) perror(""); /* fseek(fd,100,SEEK_SET); printf("%d\n",ftell(fd)); fseek(fd,100,SEEK_CUR); printf("%d\n",ftell(fd)); fseek(fd,100,SEEK_END); printf("%d\n",ftell(fd)); */ close(fd); }