static void DRV_PrintStatus(const CLS1_StdIOType *io) { uint8_t buf[48]; CLS1_SendStatusStr((unsigned char*)"drive", (unsigned char*)"\r\n", io->stdOut); CLS1_SendStatusStr((unsigned char*)" mode", DRV_GetModeStr(DRV_Status.mode), io->stdOut); CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); UTIL1_Num32sToStr(buf, sizeof(buf), DRV_Status.speed.left); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" steps/sec (curr: "); UTIL1_strcatNum32s(buf, sizeof(buf), TACHO_GetSpeed(TRUE)); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)")\r\n"); CLS1_SendStatusStr((unsigned char*)" speed left", buf, io->stdOut); UTIL1_Num32sToStr(buf, sizeof(buf), DRV_Status.speed.right); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" steps/sec (curr: "); UTIL1_strcatNum32s(buf, sizeof(buf), TACHO_GetSpeed(FALSE)); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)")\r\n"); CLS1_SendStatusStr((unsigned char*)" speed right", buf, io->stdOut); UTIL1_Num32sToStr(buf, sizeof(buf), DRV_Status.pos.left); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" (curr: "); UTIL1_strcatNum32s(buf, sizeof(buf), (int32_t)Q4CLeft_GetPos()); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)")\r\n"); CLS1_SendStatusStr((unsigned char*)" pos left", buf, io->stdOut); UTIL1_Num32sToStr(buf, sizeof(buf), DRV_Status.pos.right); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" (curr: "); UTIL1_strcatNum32s(buf, sizeof(buf), (int32_t)Q4CRight_GetPos()); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)")\r\n"); CLS1_SendStatusStr((unsigned char*)" pos right", buf, io->stdOut); }
/* ** =================================================================== ** Method : CLS1_SendNum32s (component Shell) ** Description : ** Sends a 32bit signed number to the given I/O ** Parameters : ** NAME - DESCRIPTION ** val - number to print ** io - I/O callbacks to be used for printing. ** Returns : Nothing ** =================================================================== */ void CLS1_SendNum32s(int32_t val, CLS1_StdIO_OutErr_FctType io) { unsigned char buf[sizeof("-1234567890")]; UTIL1_Num32sToStr(buf, sizeof(buf), val); CLS1_SendStr(buf, io); }
static void PrintPIDstatus(PID_Config *config, const unsigned char *kindStr, const CLS1_StdIOType *io) { unsigned char buf[48]; unsigned char kindBuf[16]; UTIL1_strcpy(kindBuf, sizeof(buf), (unsigned char*)" "); UTIL1_strcat(kindBuf, sizeof(buf), kindStr); UTIL1_strcat(kindBuf, sizeof(buf), (unsigned char*)" PID"); UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"p: "); UTIL1_strcatNum32s(buf, sizeof(buf), config->pFactor100); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" i: "); UTIL1_strcatNum32s(buf, sizeof(buf), config->iFactor100); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" d: "); UTIL1_strcatNum32s(buf, sizeof(buf), config->dFactor100); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); CLS1_SendStatusStr(kindBuf, buf, io->stdOut); UTIL1_strcpy(kindBuf, sizeof(buf), (unsigned char*)" "); UTIL1_strcat(kindBuf, sizeof(buf), kindStr); UTIL1_strcat(kindBuf, sizeof(buf), (unsigned char*)" windup"); UTIL1_Num32sToStr(buf, sizeof(buf), config->iAntiWindup); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); CLS1_SendStatusStr(kindBuf, buf, io->stdOut); UTIL1_strcpy(kindBuf, sizeof(buf), (unsigned char*)" "); UTIL1_strcat(kindBuf, sizeof(buf), kindStr); UTIL1_strcat(kindBuf, sizeof(buf), (unsigned char*)" speed"); UTIL1_Num8uToStr(buf, sizeof(buf), config->maxSpeedPercent); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"%\r\n"); CLS1_SendStatusStr(kindBuf, buf, io->stdOut); }
static uint8_t PrintStatus(CLS1_ConstStdIOType *io) { uint8_t buf[16]; CLS1_SendStatusStr((unsigned char*)"midi", (const unsigned char*)"\r\n", io->stdOut); UTIL1_Num32sToStr(buf, sizeof(buf), MM_SetSong); UTIL1_strcat(buf, sizeof(buf), (const unsigned char*)"\r\n"); CLS1_SendStatusStr((unsigned char*)" set song", buf, io->stdOut); return ERR_OK; }
/*! * \brief Prints the status text to the console * \param io StdIO handler * \return ERR_OK or failure code */ static uint8_t SHELL_PrintStatus(const CLS1_StdIOType *io) { uint8_t buf[16]; CLS1_SendStatusStr("Shell", "\r\n", io->stdOut); UTIL1_Num32sToStr(buf, sizeof(buf), SHELL_val); UTIL1_strcat(buf, sizeof(buf), "\r\n"); CLS1_SendStatusStr(" val", buf, io->stdOut); return ERR_OK; }
static void SpeedTest(void) { /* update the display every 20 ms */ int i; uint8_t buf[16]; FDisp1_PixelDim x, y; GDisp1_Clear(); GDisp1_UpdateFull(); for(i=0; i<100; i++) { GDisp1_Clear(); UTIL1_Num32sToStr(buf, sizeof(buf), i); x = 0; y = 0; FDisp1_WriteString(buf, GDisp1_COLOR_BLACK, &x, &y, Helv8_GetFont()); GDisp1_UpdateFull(); WAIT1_Waitms(20); } }
static uint8_t PrintStatus(const CLS1_StdIOType *io) { int i; uint8_t buf[16], buf2[32]; CLS1_SendStatusStr((uint8_t*)"Floppy", (uint8_t*)"\r\n", io->stdOut); UTIL1_Num32sToStr(buf, sizeof(buf), FLOPPY_NoteOffset); UTIL1_strcat(buf, sizeof(buf), (uint8_t*)"\r\n"); CLS1_SendStatusStr((uint8_t*)" note offset", buf, io->stdOut); for(i=0;i<FLOPPY_NOF_DRIVES;i++) { UTIL1_strcpy(buf, sizeof(buf), (uint8_t*)" drive "); UTIL1_strcatNum16u(buf, sizeof(buf), (uint16_t)i); UTIL1_chcat(buf, sizeof(buf), ':'); buf2[0] = '\0'; if (FLOPPY_Drives[i].forward) { UTIL1_strcat(buf2, sizeof(buf2), (uint8_t*)"fw "); } else { UTIL1_strcat(buf2, sizeof(buf2), (uint8_t*)"bw "); } UTIL1_strcatNum16s(buf2, sizeof(buf2), FLOPPY_Drives[i].pos); UTIL1_strcat(buf2, sizeof(buf2), (uint8_t*)"\r\n"); CLS1_SendStatusStr(buf, buf2, io->stdOut); } return ERR_OK; }