//change by cmj void PC_DispChar (INT8U x, INT8U y, INT8U c, INT8U color) { //OS_ENTER_CRITICAL(); OSSchedLock(); Uart_SendChar(0xff); Uart_SendChar(x); Uart_SendChar(y); Uart_SendChar(c); Uart_SendChar(color); //OS_EXIT_CRITICAL(); OSSchedUnlock(); }
/** * @brief Send out a fixed length number * * Number of digits of the num is limited by arm_math * * @param num Number to be sent * @param digit Number of digits * * @see Uart_SendChar * @see pow10 * * */ void Uart_FixSendInt(int num,int digit){ /*send an integer*/ int _num = num; int i; if (_num < 0){ Uart_SendChar('-'); _num = -1 * _num; }else{ Uart_SendChar('+'); } for(i = digit; i >= 0; --i){ Uart_SendChar('0'+ (_num / pow10(i) % 10)); } return; }
/** * @brief Send out a floating point number * * @param num Number to be sent * * @see Uart_SendInt * @see Uart_SendChar * */ void Uart_SendFloat(float num){ int copy; if (num<0){ Uart_Print("-"); num = -1*num; } copy=(int)num; //print the first part as integer Uart_SendInt(copy); //print the decimal part Uart_SendChar('.'); Uart_SendChar('0'+(int)(num*10)%10); Uart_SendChar('0'+(int)(num*100)%10); Uart_SendChar('0'+(int)(num*1000)%10); Uart_SendChar('0'+(int)(num*10000)%10); return; }
void send_message(unsigned char length, unsigned char* data_buffer) { unsigned char i; for(i=0;i<length;){ if(message_send_over_flag == 0){ message_send_over_flag = 1; Uart_SendChar(data_buffer[i++]); } } }
/** * @brief Send out a Interger * * Number of digits of the num is limited by arm_math * * @param num number to be sent * @see Uart_SendChar * @see numDigi * */ void Uart_SendInt(int num){ int digi; int i; digi=numDigi(num); if (num<0){ Uart_Print("-"); num = -1*num; } for (i=digi-1;i>=0;i--){ Uart_SendChar('0'+(int)(num/pow10(i))%10); } return; }
/** * @brief Send out a 1 digit number * * @param num Number to be sent * * @see Uart_SendChar * */ void Uart_SendBit(int num){ /*send a 1 place number*/ Uart_SendChar('0'+ num); return; }
/** * @brief Send out a string * * @param p string * * @see Uart_SendChar * */ void Uart_Print(char *p){ /*send a string*/ while(*p!='\0') { Uart_SendChar(*p++); } return; }