Fixed debug output

Added better test
This commit is contained in:
Sebastian 2016-12-04 20:51:19 +01:00
parent 93f060a5f2
commit 2c0ffe30b6
2 changed files with 18 additions and 15 deletions

View File

@ -107,7 +107,7 @@ void *eventloop(void *arg) {
// Or read a byte send by somebody else.
res = read(serial_fd, &uart_rx_byte, 1);
if(res == 1) {
printf("Read %x\n", uart_tx_byte);
printf("Read %x\n", uart_rx_byte);
// Lock mutexes and call rx handler
pthread_mutex_lock(&state_mutex);
pthread_mutex_lock(&rx_buffer_mutex);

View File

@ -11,28 +11,31 @@ int main(int argc, char const *argv[]) {
uint8_t msg[LIBSSS7_PAYLOAD_SIZE];
memset(msg, 0, LIBSSS7_PAYLOAD_SIZE);
msg[0] = 'H';
msg[1] = 'e';
msg[1] = 'a';
msg[2] = 'l';
msg[3] = 'l';
msg[4] = 'o';
msg[5] = ' ';
msg[6] = 'W';
msg[7] = 'o';
msg[8] = 'r';
msg[9] = 'l';
msg[10] = 'd';
msg[7] = 'e';
msg[8] = 'l';
msg[9] = 't';
//while(1) {
while(!libsss7_can_send());
libsss7_send(msg);
while(!libsss7_can_send());
if(libsss7_send_failed()) {
printf("Send failed\n");
}
while(!libsss7_has_received());
uint8_t tmp[LIBSSS7_PAYLOAD_SIZE + 1];
memset(tmp, 0, LIBSSS7_PAYLOAD_SIZE + 1);
libsss7_get_received(tmp);
printf("Received: %s\n", tmp);
while(!libsss7_can_send());
libsss7_send(msg);
while(!libsss7_can_send());
if(libsss7_send_failed()) {
printf("Send failed\n");
}
sleep(5);
//}
libsss7_send(msg);