diff options
Diffstat (limited to 'firmware/uart.c')
-rw-r--r-- | firmware/uart.c | 68 |
1 files changed, 10 insertions, 58 deletions
diff --git a/firmware/uart.c b/firmware/uart.c index 02b4a87..9ae00c9 100644 --- a/firmware/uart.c +++ b/firmware/uart.c @@ -39,7 +39,7 @@ void uart_parser(char *buf) break; default: answer[1] = RSP_UNKOWN_CMD; - answer[2] = '\0'; + answer[2] = 0; CommandAnswer(3); } } @@ -47,7 +47,7 @@ void uart_parser(char *buf) void uart_init_usb(char uartport) { answer[1] = (unsigned char)uart_init(uartport); - answer[2] = '\0'; + answer[2] = 0; CommandAnswer(3); } @@ -78,7 +78,7 @@ char uart_init(char uartport) void uart_deinit_usb(char uartport) { answer[1] = (unsigned char)uart_deinit(uartport); - answer[2] = '\0'; + answer[2] = 0; CommandAnswer(3); } @@ -113,7 +113,7 @@ char uart_deinit(char uartport) void uart_baudrate_usb(char uartport, char ubrrll, char ubrrlh, char ubrrhl, char ubrrhh) { answer[1] = (unsigned char)uart_baudrate(uartport, ubrrll, ubrrlh, ubrrhl, ubrrhh); - answer[2] = '\0'; + answer[2] = 0; CommandAnswer(3); } @@ -140,7 +140,7 @@ char uart_baudrate(char uartport, char ubrrll, char ubrrlh, char ubrrhl, char ub void uart_stopbits_usb(char uartport, char stopbits) { answer[1] = (unsigned char)uart_stopbits(uartport, stopbits); - answer[2] = '\0'; + answer[2] = 0; CommandAnswer(3); } @@ -174,7 +174,7 @@ char uart_stopbits(char uartport, char stopbits) void uart_databits_usb(char uartport, char databits) { answer[1] = (unsigned char)uart_databits(uartport, databits); - answer[2] = '\0'; + answer[2] = 0; CommandAnswer(3); } @@ -209,7 +209,7 @@ char uart_databits(char uartport, char databits) void uart_parity_usb(char uartport, char parity) { answer[1] = (unsigned char)uart_databits(uartport, parity); - answer[2] = '\0'; + answer[2] = 0; CommandAnswer(3); } @@ -243,7 +243,7 @@ char uart_parity(char uartport, char parity) void uart_send_usb(char uartport, char length, char *buf) { answer[1] = (unsigned char)uart_send(uartport, length, buf); - answer[2] = '\0'; + answer[2] = 0; CommandAnswer(3); } @@ -255,9 +255,7 @@ char uart_send(char uartport, unsigned int length, char *buf) return RSP_UNKOWN_PIN; while(length--) - { uart_putchar(uartport, *buf++); - } return RSP_OK; } @@ -295,6 +293,8 @@ void uart_recv_usb(char uartport, int length) for(i = 0; i < length; i++) answer[2+i] = data[i]; + answer[2+length] = 0; + CommandAnswer(3+length); } @@ -330,52 +330,4 @@ char uart_getchar(char uartport) return c; } -/* -unsigned char AsciiToHex(unsigned char high,unsigned char low) -{ - unsigned char new; - - // check if lower equal 9 ( ascii 57 ) - if(high <= 57) // high is a number - high = high -48; - else // high is a letter - high = high -87; - - high = high << 4; - high = high & 0xF0; - - // check if lower equal 9 ( ascii 57 ) - if(low <= 57) // high is a number - low = low -48; - else // high is a letter - low = low -87; - low = low & 0x0F; - - new = high | low; - - return new; -} -void SendHex(unsigned char hex) -{ - unsigned char high,low; - // get highnibble - high = hex & 0xF0; - high = high >> 4; - - // get lownibble - low = hex & 0x0F; - - if(high<=9) - UARTPutChar(high+48); - else - UARTPutChar(high+87); - - - if(low<=9) - UARTPutChar(low+48); - else - UARTPutChar(low+87); - -} -*/ |