update UART_display_u8

This commit is contained in:
weiting2
2020-04-10 17:22:08 +08:00
parent 64834465a2
commit 4ba2ae59c4
3 changed files with 25 additions and 6 deletions
@@ -36,7 +36,7 @@ static void mem_UART_display(char *str){
}
str_size ++;
char *out_str = malloc((str_size+2) * sizeof(uint8_t));
char *out_str = malloc((str_size+2) * sizeof(char));
// char *out_str = str;
for(int i=0 ; i<str_size ; i++){
@@ -57,6 +57,25 @@ static void mem_UART_clear_screen(){
UART_write(handle, cls, sizeof(cls));
}
static void mem_UART_display_u8(char *str){
// calculate string size
uint8_t str_size;
for(str_size=0 ; *(str+str_size)!='\0' && str_size < 49; str_size++){
// do nothing
}
str_size ++;
uint8_t *out_str = malloc((str_size+2) * sizeof(uint8_t));
for(int i=0 ; i<str_size ; i++){
*(out_str+i) = (uint8_t) *(str+i);
}
out_str[str_size] = '\n';
out_str[str_size + 1] = '\r';
UART_write(handle, out_str, str_size+2);
free(out_str);
out_str = NULL;
}
#endif
@@ -1271,7 +1271,7 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg)
ret[2] = pMsg->msg.readRsp.pValue[2];
ret[3] = '\0';
mem_UART_display("Read rsp: ");
mem_UART_display(ret);
mem_UART_display_u8(ret);
}
@@ -4,13 +4,13 @@
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 4
#define VERSION_DATE_DAY 9
#define VERSION_DATE_HOUR 15
#define VERSION_DATE_MINUTE 26
#define VERSION_DATE_DAY 10
#define VERSION_DATE_HOUR 17
#define VERSION_DATE_MINUTE 21
// this is NOT the version hash !!
// it's the last version hash
#define VERSION_HASH cc3a6c0eec1b91e91718573da81f8fe587b4aeec
#define VERSION_HASH 64834465a251ac307f02bf4501afe70f10c549c6
#define VERSION_GIT_BRANCH MemBoard_simple_central
#endif