From 20296f0e3fba148b901fb960b10ad824feee0092 Mon Sep 17 00:00:00 2001 From: Brendan Bartels <bbartels@iastate.edu> Date: Sun, 12 Mar 2017 14:10:38 -0500 Subject: [PATCH] wip: add hardware test for I2CDriver --- .../modular_quad_pid/src/hw_impl_zybo_tests.c | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/quad/xsdk_workspace/modular_quad_pid/src/hw_impl_zybo_tests.c b/quad/xsdk_workspace/modular_quad_pid/src/hw_impl_zybo_tests.c index 865830b39..7ec8c2ed5 100644 --- a/quad/xsdk_workspace/modular_quad_pid/src/hw_impl_zybo_tests.c +++ b/quad/xsdk_workspace/modular_quad_pid/src/hw_impl_zybo_tests.c @@ -4,13 +4,17 @@ #include <stdio.h> /** - * Use the LEDDriver and SystemDriver to create a basic "blink" program, - * using the mio7 LED on the Zybo board. + * Test for the LEDDriver and SystemDriver. + * + * This is essentially a basic "blink" program, using the mio7 LED + * on the Zybo board. * * Instructions: - * 1) Use the USB cable and plug Zybo board into computer. - * 2) Run. - * 3) Observe MIO7 LED on board blinking at 1 second intervals. + * 1) Connect Zybo board to computer by USB cable. + * 2) Set the RUN_TESTS macro in main.c + * 3) Uncomment only this test in main.c + * 4) Run main.c + * 5) Observe MIO7 LED on board blinking at 1 second intervals. */ int test_zybo_mio7_led_and_system() { struct LEDDriver mio7 = create_zybo_mio7_led(); @@ -28,6 +32,27 @@ int test_zybo_mio7_led_and_system() { return 0; } +/** + * Test for the I2CDriver. + * + * Raw I2C tests are tedius, so we are going to cheat a bit, and use + * some of the LIDAR code we have. + * + * Instructions: + * 1) Connect Zybo Board to computer by USB cable. + * 2) Prepare a breadboard to accomplish the following connections: + * - Zybo GND <-> LIDAR GND + * - Zybo WALL <-> LIDAR VCC + * - Zybo VV5V0 <-> LIDAR VCC + * - Zybo SDA/SCL <-> LIDAR SDA/SCL + * - The Zybo I2C SCL and SDA pins are on pins 1 and 2 of PORT JF, respectively + * 3) Place breakpoint in this test function, somewhere in the while loop. + * 4) Set the RUN_TESTS macro in main.c + * 5) Uncomment only this test in main.c + * 6) Debug main.c + * 7) Step through the while loop, observing x change as you physically change the + * distance of the LIDAR sensor. + */ int test_zybo_i2c() { struct I2CDriver i2c = create_zybo_i2c(); struct SystemDriver sys = create_zybo_system(); -- GitLab