void key_set(void) { unsigned char key_value; key_value=P1; key_value&=0x07; //提取按键键值 if(key_value!=7) //按键按下 { if(!key_hold) //按键第一次按下 { key_hold=1; //按键保持按下状态 switch (key_value) { //set键按下 case 6: { if(key_set_flag==0) //首次进入温度设置 { key_set_flag=1; //进入温度设定状态 }else { key_set_flag=0; //清空温度设定标志 Change_step=1; //恢复缺省设定步进值 } break; } //+键按下 case 5: { if(key_set_flag) {Set_temp+=Change_step;show1(Set_temp);} break; } //-键按下 case 3: { if(key_set_flag) {Set_temp-=Change_step;show1(Set_temp);} break; } default: break; } } else if(key_set_flag) { //按键一直处于按下状态 key_hold++; if(key_hold>5) //按键计数超过设定时长 { Change_step=16; //设定步长按1度步进 key_hold=0; //清空按键保持状态,进入加减按键功能 } } }else if(key_hold) { key_hold=0; //按键松开状态 Change_step=1; } }
void showNumber(uint8_t number) { if(number == 0) { show0(); } else if(number == 1) { show1(); } else if(number == 2) { show2(); } else if(number == 3) { show3(); } else if(number == 4) { show4(); } else if(number == 5) { show5(); } else if(number == 6) { show6(); } else if(number == 7) { show7(); } else if(number == 8) { show8(); } else if(number == 9) { show9(); } }
int main(){ int num = 10; show(5); show(num); show1(13,7); return 0; }
int main() { float f1 = 1.2e3; show1("<f1 = 1.2e3>"); show(f1, f); return (0); }
void show3(int indx) { switch (iven[indx]) { case OPOTION: show1(indx, potionname); break; case OSCROLL: show1(indx, scrollname); break; case OLARNEYE: case OBOOK: case OSPIRITSCARAB: case ODIAMOND: case ORUBY: case OCUBEofUNDEAD: case OEMERALD: case OCHEST: case OCOOKIE: case OSAPPHIRE: case ONOTHEFT: show1(indx, NULL); break; default: lprintf("\n%c) %s", indx + 'a', objectname[iven[indx]]); if (ivenarg[indx] > 0) lprintf(" + %ld", (long) ivenarg[indx]); else if (ivenarg[indx] < 0) lprintf(" %ld", (long) ivenarg[indx]); break; } if (c[WIELD] == indx) lprcat(" (weapon in hand)"); if ((c[WEAR] == indx) || (c[SHIELD] == indx)) lprcat(" (being worn)"); if (++srcount >= 22) { srcount = 0; more(); clear(); } }
int main(void) { int num[N1][N2]; init(num); show(num); sort_sel(num); show1(nu); return 0; }
void Segment::display(int number) { this->offAll(); switch(number) { case 0: show0(); // delay(500); break; case 1: show1(); // delay(500); break; case 2: show2(); // delay(500); break; case 3: show3(); // delay(500); break; case 4: show4(); // delay(500); break; case 5: show5(); // delay(500); break; case 6: show6(); // delay(500); break; case 7: show7(); // delay(500); break; case 8: show8(); // delay(500); break; case 9: show9(); // delay(500); break; default: showE(); // delay(500); break; } }
int main (int argc, char** argv){ SDL_Window *window = NULL ; SDL_Surface *screen = NULL; SDL_Renderer* renderer = NULL; SDL_Init(SDL_INIT_VIDEO); IMG_Init(IMG_INIT_PNG); int ON1 = 1; menu(window ,screen,ON1); int ON2 = 1; show1(window , renderer, ON2 ); IMG_Quit(); SDL_FreeSurface(screen); SDL_DestroyWindow(window); SDL_Quit(); return EXIT_SUCCESS; }
static void test1() { show1(""); show2(""); }
void show(uint8_t i) { show1(digit % 10); show2(digit / 10 % 10); }