void dumpArgsInt(void) { rprintfCRLF(); rprintf("Dump arguments as integers\r\n"); // printf %d will work but only if your numbers are less than 16-bit values //rprintf("Arg1 as int: %d\r\n", cmdlineGetArgInt(1)); //rprintf("Arg2 as int: %d\r\n", cmdlineGetArgInt(2)); //rprintf("Arg3 as int: %d\r\n", cmdlineGetArgInt(3)); // printfNum is good for longs too rprintf("Arg1 as int: "); rprintfNum(10, 10, TRUE, ' ', cmdlineGetArgInt(1)); rprintfCRLF(); rprintf("Arg2 as int: "); rprintfNum(10, 10, TRUE, ' ', cmdlineGetArgInt(2)); rprintfCRLF(); rprintf("Arg3 as int: "); rprintfNum(10, 10, TRUE, ' ', cmdlineGetArgInt(3)); rprintfCRLF(); rprintfCRLF(); }
void setTime(void) { TM_RTC_Time_t time; int tmp=0; TM_RTC_GetDateTime(&time, TM_RTC_Format_BIN); tmp = cmdlineGetArgInt(1); if (tmp > 0 && tmp < 25) time.hours=tmp; tmp = cmdlineGetArgInt(2); if (tmp > 0 && tmp < 61) time.minutes=tmp; tmp = cmdlineGetArgInt(3); if (tmp > 0 && tmp < 61) time.seconds=tmp; TM_RTC_SetDateTime(&time, TM_RTC_Format_BIN); conf_bit(SET,SETTINGS_1,TIME_SET); TM_USART_Puts(MENU_USART,"Time has been sucessfully set!\n\r"); }
void setDate(void) { TM_RTC_Time_t time; int tmp=0; TM_RTC_GetDateTime(&time, TM_RTC_Format_BIN); tmp = cmdlineGetArgInt(1); if (tmp > 0 && tmp < 32) time.date=tmp; tmp = cmdlineGetArgInt(2); if (tmp > 0 && tmp < 13) time.month=tmp; tmp = cmdlineGetArgInt(3); if (tmp >= 0 && tmp <= 99) time.year=tmp; TM_RTC_SetDateTime(&time, TM_RTC_Format_BIN); conf_bit(SET,SETTINGS_1,DATE_SET); TM_USART_Puts(MENU_USART,"Date has been sucessfully set!\n\r"); }
void set_ID(void) { uint8_t id[]= {cmdlineGetArgInt(1)}; config(GC_SAVE,id,GC_ID); }