/// @param[in] str: User supplied command line /// /// @return 1 The ruturn code indicates a command matched. /// @return 0 if no rules matched MEMSPACE int user_tests(char *str) { int res; int len; char *ptr; long p1, p2; time_t t; ptr = skipspaces(str); if ((len = token(ptr,"help")) ) { ptr += len; user_help(); return(1); } if ((len = token(ptr,"setdate")) ) { ptr += len; ptr = skipspaces(str); setdate_r(ptr); return(1); } if ((len = token(ptr,"time")) ) { t = time(0); DEBUG_PRINTF("TIME:%s\n", ctime(&t)); return(1); } return(0); }
/// @param[in] str: User supplied command line /// /// @return 1 The return code indicates a command matched. /// @return 0 if no rules matched MEMSPACE int user_tests(int argc, char *argv[]) { char *ptr; time_t t; double freq; extern int connections; int ind; if(argc < 2) return(0); ind = 1; ptr = argv[ind++]; if (MATCHARGS(ptr,"help", (ind+0),argc )) { user_help(); return(1); } #ifdef POSIX_TESTS if(posix_tests(argc,argv)) return(1); #endif #ifdef FATFS_TESTS if(fatfs_tests(argc,argv)) return(1); #endif #ifdef ADF4351 if (MATCHARGS(ptr,"adf4351", (ind + 1) ,argc)) { adf4351_cmd(argc,argv); return(1); } #endif if (MATCHARGS(ptr,"setdate", (ind + 1) ,argc)) { setdate_r(argv[ind++]); return(1); } if (MATCHARGS(ptr,"display_clock", (ind + 0) ,argc)) { display_clock(); return(1); } if (MATCHARGS(ptr,"time", (ind + 0) ,argc)) { t = time(0); printf("TIME:%s\n", ctime(&t)); return(1); } if (MATCHARGS(ptr,"connection", (ind + 0) ,argc)) { printf("connections:%d\n", connections); return(1); } if (MATCHARGS(ptr,"mem", (ind + 0) ,argc)) { PrintRam(); return(1); } if (MATCHARGS(ptr,"timetest", (ind + 1) ,argc)) { timetests(argv[ind++],0); return(1); } #ifdef DISPLAY if (MATCHARGS(ptr,"calibrate", (ind + 1) ,argc)) { int ret = atoi(argv[ind++]); tft_setRotation(ret); tft_touch_calibrate(master); MatWrite("/tft_calX",tft_calX); MatWrite("/tft_calY",tft_calY); setup_windows(ret & 3,0); return(1); } if (MATCHARGS(ptr,"calibrate_test", (ind + 1) ,argc)) { int ret = atoi(argv[ind++]); tft_setRotation(ret); tft_touch_calibrate(master); MatWrite("/tft_calX",tft_calX); MatWrite("/tft_calY",tft_calY); tft_map_test(master, 10); setup_windows(ret & 3,0); return(1); } if (MATCHARGS(ptr,"rotate", (ind + 1) ,argc)) { // FIXME rotate calibration data ??? int ret = atoi(argv[ind++]); tft_setRotation(ret); setup_windows(ret & 3,0); return(1); } #ifdef VFONTS if (MATCHARGS(ptr,"draw", (ind + 1) ,argc)) { char *ptr = argv[ind++]; int c = *ptr++; int n = *ptr++; if( n == '1') drawSVG(winmsg, 8, 24, c, 0.08, ILI9341_WHITE, 1); else drawSVG(winmsg, 8, 24, c, 0.08, ILI9341_WHITE, 0); return(1); } #endif if (MATCHARGS(ptr,"pixel", (ind + 0) ,argc)) { int c; int x,y; tft_drawPixel(winmsg, 8, 24, ILI9341_WHITE); for(y=24;y<26;++y) { for(x=8;x<10;++x) { c = tft_readPixel(winmsg, x, y); printf("pixel(%d,%d): %04x\n", x,y,c); } } return(1); } #endif //DISPLAY return(0); }