spitest; print received/transmitted bytes.

Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f9dc1bec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f9dc1bec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f9dc1bec

Branch: refs/heads/develop
Commit: f9dc1becb2af033bc1f4ee3d795798dced4e03d0
Parents: 97bf286
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Oct 18 10:11:09 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Oct 18 13:15:41 2016 -0700

----------------------------------------------------------------------
 apps/spitest/src/main.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f9dc1bec/apps/spitest/src/main.c
----------------------------------------------------------------------
diff --git a/apps/spitest/src/main.c b/apps/spitest/src/main.c
index 0059bc5..9f125ce 100755
--- a/apps/spitest/src/main.c
+++ b/apps/spitest/src/main.c
@@ -26,6 +26,7 @@
 #include <os/os_dev.h>
 #include <assert.h>
 #include <string.h>
+#include <console/console.h>
 #ifdef ARCH_sim
 #include <mcu/mcu_sim.h>
 #endif
@@ -283,6 +284,16 @@ task1_handler(void *arg)
             rc = hal_spi_txrx_noblock(0, g_spi_tx_buf, g_spi_rx_buf,
                                       spi_cb_obj.txlen);
             assert(!rc);
+            console_printf("a transmitted: ");
+            for (i = 0; i < spi_cb_obj.txlen; i++) {
+                console_printf("%2x ", g_spi_tx_buf[i]);
+            }
+            console_printf("\n");
+            console_printf("received: ");
+            for (i = 0; i < spi_cb_obj.txlen; i++) {
+                console_printf("%2x ", g_spi_rx_buf[i]);
+            }
+            console_printf("\n");
 #endif
         } else {
             /* Send blocking */
@@ -305,6 +316,16 @@ task1_handler(void *arg)
             rc = hal_spi_txrx(0, g_spi_tx_buf, g_spi_rx_buf, spi_cb_obj.txlen);
             assert(!rc);
             hal_gpio_set(SPI_SS_PIN);
+            console_printf("b transmitted: ");
+            for (i = 0; i < spi_cb_obj.txlen; i++) {
+                console_printf("%2x ", g_spi_tx_buf[i]);
+            }
+            console_printf("\n");
+            console_printf("received: ");
+            for (i = 0; i < spi_cb_obj.txlen; i++) {
+                console_printf("%2x ", g_spi_rx_buf[i]);
+            }
+            console_printf("\n");
             spitest_validate_last(spi_cb_obj.txlen);
 #endif
         }

Reply via email to