/* count in letter positions, NOT pixels */ void put_cursorxy(int x, int y, bool on) { #ifdef HAVE_LCD_BITMAP int fh, fw; int xpos, ypos; /* check here instead of at every call (ugly, but cheap) */ if (global_settings.invert_cursor) return; lcd_getstringsize("A", &fw, &fh); xpos = x*6; ypos = y*fh + lcd_getymargin(); if ( fh > 8 ) ypos += (fh - 8) / 2; #endif /* place the cursor */ if(on) { #ifdef HAVE_LCD_BITMAP lcd_mono_bitmap(bitmap_icons_6x8[Icon_Cursor], xpos, ypos, 4, 8); #else lcd_putc(x, y, CURSOR_CHAR); #endif } else { #if defined(HAVE_LCD_BITMAP) /* I use xy here since it needs to disregard the margins */ lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); lcd_fillrect (xpos, ypos, 4, 8); lcd_set_drawmode(DRMODE_SOLID); #else lcd_putc(x, y, ' '); #endif } }
static void charging_display_info(bool animate) { unsigned char charging_logo[36]; const int pox_x = (LCD_WIDTH - sizeof(charging_logo)) / 2; const int pox_y = 32; static unsigned phase = 3; unsigned i; #ifdef NEED_ATA_POWER_BATT_MEASURE if (ide_powered()) /* FM and V2 can only measure when ATA power is on */ #endif { int battv = battery_voltage(); lcd_putsf(0, 7, " Batt: %d.%02dV %d%% ", battv / 1000, (battv % 1000) / 10, battery_level()); } #ifdef ARCHOS_RECORDER lcd_puts(0, 2, "Charge mode:"); const char *s; if (charge_state == CHARGING) s = str(LANG_BATTERY_CHARGE); else if (charge_state == TOPOFF) s = str(LANG_BATTERY_TOPOFF_CHARGE); else if (charge_state == TRICKLE) s = str(LANG_BATTERY_TRICKLE_CHARGE); else s = "not charging"; lcd_puts(0, 3, s); if (!charger_enabled()) animate = false; #endif /* ARCHOS_RECORDER */ /* middle part */ memset(charging_logo+3, 0x00, 32); charging_logo[0] = 0x3C; charging_logo[1] = 0x24; charging_logo[2] = charging_logo[35] = 0xFF; if (!animate) { /* draw the outline */ /* middle part */ lcd_mono_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8); lcd_set_drawmode(DRMODE_FG); /* upper line */ charging_logo[0] = charging_logo[1] = 0x00; memset(charging_logo+2, 0x80, 34); lcd_mono_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8); /* lower line */ memset(charging_logo+2, 0x01, 34); lcd_mono_bitmap(charging_logo, pox_x, pox_y + 16, sizeof(charging_logo), 8); lcd_set_drawmode(DRMODE_SOLID); } else { /* animate the middle part */ for (i = 3; i<MIN(sizeof(charging_logo)-1, phase); i++) { if ((i-phase) % 8 == 0) { /* draw a "bubble" here */ unsigned bitpos; bitpos = (phase + i/8) % 15; /* "bounce" effect */ if (bitpos > 7) bitpos = 14 - bitpos; charging_logo[i] = BIT_N(bitpos); } } lcd_mono_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8); phase++; } lcd_update(); }