void display_text(char *str) { for(;*str; str++) { lcd_write_data(*str); } }
// Looks for any of the red buoy, green buoy, or force field emitted by the home base // If the Create is in explore mode, remember and display the zone of the victim // If the Create is in return mode, play a song and display victim found ('V'), and clear victim zone void lookForVictim() { ser_putch(142); ser_putch(17); char victim = ser_getch(); if(victim > 241 && victim != 255) { if(goingHome) { __delay_ms(1000); play_iCreate_song(3); __delay_ms(500); victimZone = 0; lcd_set_cursor(0x09); lcd_write_data('V'); xVictim = xCoord; yVictim = yCoord; } else { xVictim = xCoord; yVictim = yCoord; victimZone = getVictimZone(xCoord, yCoord); lcd_set_cursor(0x08); lcd_write_1_digit_bcd(victimZone); } } }
static void draw_img_rgb(const Image_t* img) { int i; for (i = 0; i < (img->width * img->height); i++) { lcd_write_data(img->px[i]); } }
static void lcd_write_cmd_8bit(u8 cmd) { LCD_RS_CLR; delay_us(1); lcd_write_data(cmd); LCD_RS_SET; }
static void lcd_write_parameter_16bit(u16 data) { LCD_RS_SET; delay_us(1); lcd_write_data(((data>>8)&0xff)); delay_us(1); lcd_write_data(data&0xff); }
void bghighscore_display_line(int8_t rank, int8_t lcd_line) { int8_t c; lcd_goto_position(lcd_line, 6); for (c = 0; c < INITIALS; c++) lcd_write_data(highscores[rank].initials[c]); lcd_write_byte(' '); lcd_write_int16(highscores[rank].score); }
//------------------------------------------------------------------------------ void LCD_Show_Text(char* Text) { int i; for(i=0;i<strlen(Text);i++) { lcd_write_data(LCD_BASE,Text[i]); usleep(2000); } }
void bggame_write_board(game_t game) { int8_t r, c; for (r=0; r < game.height; r++) { lcd_goto_position(r, 0); for (c=0; c < game.width; c++) { lcd_write_data(game.board[r][c]); } } }
void init_menu(void) { //Start randomizer for obstacles start_timer_for_randomizer(); //Add right arrow character for(int i=0;i<8;i++) { lcd_write_ctrl(LCD_CGRAM+i); lcd_write_data(__cmenu[i]); } refresh_menu(); lcd_gotoxy(0,0); lcd_write_data(0); start = 1; }
// Checks to see if the robot's current location is the pre-determined final destination // If it is, set the goingHome bit and display 'return mode' on LCD void checkForFinalDestination() { if((xCoord == getFinalX()) && (yCoord == getFinalY())) { play_iCreate_song(2); goingHome = TRUE; lcd_set_cursor(0x06); lcd_write_data('R'); } }
void lcd_clear(uint16_t bg){ uint32_t i; lcd_set_cursor(0,0); for(i=0;i<MAX_X*MAX_Y;i++){ lcd_write_data(bg); } }
//---------------------------------------------------------------------------------------- // // Wys�anie stringa do wy�wietlacza LCD z pami�ci EEPROM // // 8 w�asnych znak�w zdefiniowanych w CGRAM // wysy�amy za pomoc� kod�w 0x80 do 0x87 zamiast 0x00 do 0x07 // //---------------------------------------------------------------------------------------- void lcd_str_E(char * str) { register char znak; while(1) { znak=eeprom_read_byte( (uint8_t *)(str++) ); if(!znak || znak==0xFF) break; else lcd_write_data( ( (znak>=0x80) && (znak<=0x87) ) ? (znak & 0x07) : znak); } }
static void lcd_write_cmd_16bit(u16 cmd) { LCD_RS_CLR; delay_us(1); lcd_write_data(((cmd>>8)&0xff)); delay_us(1); lcd_write_data(cmd&0xff); LCD_RS_SET; }
//Move selection to settings void menu_move_settings(){ refresh_menu(); lcd_gotoxy(7,0); lcd_write_data(0); start = 2; }
//Move selection to start void menu_move_start(){ refresh_menu(); lcd_gotoxy(0,0); lcd_write_data(0); start = 1; }
void bggame_set_selection(game_t *game, point_t *selection, point_t cursor) { selection->row = cursor.row; selection->column = cursor.column; selection->meta |= PM_SELECTED; game->board[selection->row][selection->column] &= ~0x20; lcd_goto_position(selection->row, selection->column); lcd_write_data(game->board[selection->row][selection->column]); }
//---------------------------------------------------------------------------------------- // // Definicja w�asnego znaku na LCD z pami�ci FLASH // // argumenty: // nr: - kod znaku w pami�ci CGRAM od 0x80 do 0x87 // *def_znak: - wska�nik do tablicy 7 bajt�w definiuj�cych znak // //---------------------------------------------------------------------------------------- void lcd_defchar_P(uint8_t nr, uint8_t *def_znak) { register uint8_t i,c; lcd_write_cmd( 64+((nr&0x07)*8) ); for(i=0;i<8;i++) { c = pgm_read_byte(def_znak++); lcd_write_data(c); } }
void lcd_cgram_init() { unsigned char i, j; lcd_command(0x40); for(j = 0; j < 6; ++j) { for(i = 0; i < 8; ++i) { lcd_write_data(custom_char_bitmap[i][j]); } } }
static void fill_rect(rect_t rect, color_t color) { int i; gfx_set_cursor(rect.x, rect.y, rect.x + rect.width - 1, rect.y + rect.height - 1); for (i = 0; i < (rect.width * rect.height); ++i) { lcd_write_data(color); } }
void draw_vert_line(int x, int y, int l) { int i; gfx_set_cursor(x, y, x, y + l); for (i = 0; i < l; i++) { lcd_write_data(ctx->fcolor); } lcd_clr_cursor(); }
static void draw_horiz_line(int x, int y, int l) { int i; gfx_set_cursor(x, y, x + l, y); for (i = 0; i < l + 1; i++) { lcd_write_data(ctx->fcolor); } lcd_clr_cursor(); }
//Move selection to high scores void menu_move_scores(){ refresh_menu(); lcd_gotoxy(2,1); lcd_write_data(0); start = 3; }
// Finds where there are walls around the Create's location void findWalls() { rotateIR(24, CCW); lcd_set_cursor(0x0B); leftWall = findWall(); if(leftWall) lcd_write_data('L'); else lcd_write_data(' '); rotateIR(24, CW); frontWall = findWall(); if(frontWall) lcd_write_data('F'); else lcd_write_data(' '); rotateIR(24, CW); rightWall = findWall(); if(rightWall) { play_iCreate_song(5); lcd_write_data('R'); }else lcd_write_data(' '); rotateIR(24, CCW); }
void SetupAlarmTimeC() //Program to get Alarm Time for Subject C { unsigned char msgindex, outchar, ctemp; unsigned char hour10, hour1, minute10, minute1; char Message[ ] = "Subject C Time hhmm:"; PORTA = 0b00001000; //On LED RA3 lcd_write_cmd(0x80); for (msgindex = 0; msgindex < 20; msgindex++) { outchar = Message[msgindex]; lcd_write_data(outchar); } lcd_write_cmd(0xC0); // Move cursor to line 2 position 1 ctemp=getkey(); // waits and get an ascii key number when pressed lcd_write_data(ctemp); //display on LCD hour10 = char_2_int (ctemp); ctemp=getkey(); lcd_write_data(ctemp); hour1 = char_2_int (ctemp); ctemp=getkey(); lcd_write_data(ctemp); minute10 = char_2_int (ctemp); ctemp=getkey(); lcd_write_data(ctemp); minute1 = char_2_int (ctemp); hourC = hour10 * 10 + hour1; minuteC = minute10 * 10 + minute1; delay_ms(500); lcd_write_cmd(0x01); }
void lcd_update(void) { /* Setup initial PAGE and COLUMN address * the addressing circuit will take care of the rest */ lcd_write_command_ex(LCD_CNTL_PAGE, 0, -1); lcd_write_command_ex(LCD_CNTL_COLUMN, 0, -1); lcd_write_command(LCD_CNTL_DATA_WRITE); /* Copy display bitmap to hardware */ lcd_write_data (&lcd_framebuffer[0][0], LCD_WIDTH*LCD_FBHEIGHT); }
void getTemp() { uint16_t last_sample = 0; double this_temp; double temp_avg; uint16_t i; temp_avg = 0.0; for (i=0; i<500; i++) { last_sample = adc_read(); this_temp = sampleToFahrenheit(last_sample); temp_avg = temp_avg + this_temp/500.0; } double c = fahrenheitToCelsius(temp_avg); double k = celsiusToKelvin(c); // write message to LCD lcd_init(); FILE lcd_stream = FDEV_SETUP_STREAM(lcd_putchar, 0, _FDEV_SETUP_WRITE); lcd_home(); lcd_write_string(PSTR("ADC: ")); lcd_write_int16(last_sample); lcd_write_string(PSTR(" of 1024 ")); lcd_line_two(); fprintf_P(&lcd_stream, PSTR("%.2f"), temp_avg); lcd_write_data(0xdf); lcd_write_string(PSTR("F")); lcd_line_three(); fprintf_P(&lcd_stream, PSTR("%.2f"), c); lcd_write_data(0xdf); lcd_write_string(PSTR("C")); lcd_line_four(); fprintf_P(&lcd_stream, PSTR("%.2f"), k); lcd_write_data(0xdf); lcd_write_string(PSTR("K")); }
/* Performance function that works with an external buffer note that by and bheight are in 8-pixel units! */ void lcd_blit_mono(const unsigned char *data, int x, int by, int width, int bheight, int stride) { const unsigned char *src, *src_end; unsigned char *dst_u, *dst_l; static unsigned char upper[LCD_WIDTH] IBSS_ATTR; static unsigned char lower[LCD_WIDTH] IBSS_ATTR; unsigned int byte; by *= 2; while (bheight--) { src = data; src_end = data + width; dst_u = upper; dst_l = lower; do { byte = *src++; *dst_u++ = lcd_dibits[byte & 0x0F]; byte >>= 4; *dst_l++ = lcd_dibits[byte & 0x0F]; } while (src < src_end); lcd_write_reg_ex(LCD_CNTL_PAGE, by++, -1); lcd_write_reg_ex(LCD_CNTL_COLUMN, x, -1); lcd_send_cmd(LCD_CNTL_DATA_WRITE); lcd_write_data(upper, width); lcd_write_reg_ex(LCD_CNTL_PAGE, by++, -1); lcd_write_reg_ex(LCD_CNTL_COLUMN, x, -1); lcd_send_cmd(LCD_CNTL_DATA_WRITE); lcd_write_data(lower, width); data += stride; } }
void gfx_tile_bitmap(const Image_t* img, rect_t rect) { int i, j; gfx_set_cursor(rect.x, rect.y, rect.x + rect.width - 1, rect.y + rect.height - 1); for (i = 0; i < rect.height; ++i) { for (j = 0; j < rect.width; ++j) { lcd_write_data(get_tile_color(img, j, i)); } } lcd_clr_cursor(); }
bool dis_print(uint8 line, dis_align_t align, char *fmt, ...) { uint8 j; uint8 offset; char buf[6*LCD_LINE_LEN] = {0}; char temp[LCD_LINE_LEN + 1] = {0}; va_list ap; size_t len; bool is_need_scroll = false; va_start(ap, fmt); vsprintf(buf, fmt, ap); va_end(ap); len = strlen(buf); if(len > LCD_LINE_LEN){ is_need_scroll = true; if(false == IS_Flag_Valid(DISPLAY_SCROLL_LOCK)){ return is_need_scroll; } } if(align == ALIGN_CENTER){ offset = LCD_LINE_LEN > len? (LCD_LINE_LEN - len):(0); if(offset){ for(j = 0; j < offset/2; j++){ temp[j] = ' '; } strcat(temp, buf); }else{ strncpy(temp, buf, LCD_LINE_LEN); } }else{ strncpy(temp, buf, LCD_LINE_LEN); } lcd_write_cmd(line); for(j = 0; j < LCD_LINE_LEN; j++){ if(temp[j] == '<'){ lcd_write_data(0); }else if(temp[j] == '>'){ lcd_write_data(5); }else if(temp[j] == '~'){ lcd_write_data(6); }else if(temp[j] == 0){ lcd_write_data(' '); }else if(temp[j] == '^'){ lcd_write_data(4); }else{ lcd_write_data(temp[j]); } } return is_need_scroll; }
void lcd_print_strxy(unsigned char *str,unsigned char x, unsigned char y) {/* 液晶定起点写字串函数 参数: 字串、xy坐标 返回: 空 调用: lcd_write_cmd()、lcd_write_data()、lcd_pos_set() */ unsigned char i=0; lcd_pos_set(x,y); while ((str[i])!='\0'){ lcd_write_data(str[i++]); if(i==16) break; //到行末就不写了 } }