From c299194f88d35d24a5198df265995bd9866c8ee7 Mon Sep 17 00:00:00 2001 From: Adam Greenwood-Byrne Date: Thu, 30 Jul 2020 21:47:18 +0100 Subject: [PATCH] Update to part7-bluetooth to suppress noisy data --- part7-bluetooth/kernel.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/part7-bluetooth/kernel.c b/part7-bluetooth/kernel.c index e5df90d..d2dda0f 100644 --- a/part7-bluetooth/kernel.c +++ b/part7-bluetooth/kernel.c @@ -60,6 +60,17 @@ unsigned char *poll() return 0; } +void print_bdaddr(long bd_addr) +{ + unsigned char byte; + + for (int c=9;c>=4;c--) { + byte = (unsigned char)((bd_addr >> ((c-4)*8) & 0xff)); + uart_hex(byte); + if (c != 4) uart_writeText(":"); + } +} + void bt_update() { unsigned char *buf; @@ -70,7 +81,7 @@ void bt_update() unsigned int c=0; if (numreports > 0 && data_len >= 11) { - uart_writeText("\ra("); + uart_writeText("\ra("); for (int c=9;c>=4;c--) { if (c != 9) uart_writeText(":"); uart_hex(buf[c]); @@ -88,11 +99,10 @@ void bt_update() buf += 2; if (ad_len > 2) { - uart_writeText(" -> adtype("); uart_hex(ad_type); uart_writeText(":"); uart_hex(ad_len); uart_writeText(")"); - if (ad_type == 0x09 || ad_type == 0x08) { unsigned int d=0; + uart_writeText(" -> adtype("); uart_hex(ad_type); uart_writeText(":"); uart_hex(ad_len); uart_writeText(")"); uart_writeText(" -> "); while (d