void banner() { //console banner printf_P(PSTR("Syzygryd Memorial Cube Firmware. Hello!\n")); //give the user a visual indication of battery health... uint8_t bat = get_battery_percent(); if(bat == 0) { lowbat(); } else { // Show the battery level send_rgb(100 - bat, bat, 0); _delay_ms(1000); send_rgb(0, 0, 0); } }
void run(void) { XEvent xe; while(1){ while(QLength(disp)) { XNextEvent(disp, &xe); } int bat = get_battery_percent(bat_id); height = bat*3; resize(width, height); XMoveResizeWindow(disp, win, x-width, y-height, width, height); colorR = color_in_range("#ff0000", "#00ff00", bat); draw_rectangle(0,0,width,height,1,colorW); draw_rectangle(border,border, width-(2*border),height-(2*border),1,colorR); remap(win, width, height); usleep(60000000); } }