Skip to content

Commit

Permalink
Fix blip-test and click-test compilation #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter O'Hanley committed Jan 3, 2019
1 parent 5999a6f commit 5e6952d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
17 changes: 8 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ add_executable(monitor EXCLUDE_FROM_ALL test/monitor.cpp test/test_util.c src/sp
target_link_libraries(monitor spiproto pthread)
target_include_directories(monitor PUBLIC src/ PUBLIC test/)

#TODO can only run on linux
#click-test: test/click-test.cpp libspiproto.a spi_chunks.o test/test_util.o spi_proto_util.o
# #g++ $(CFLAGS) -o click-test test/click-test.cpp -std=c++14 -pthread spi_chunks.o test/test_util.o spi_proto_util.o -L. -lspiproto -I. -Isrc
# g++ test/click-test.cpp src/spi_proto_master.cpp src/spi_chunks.cpp -std=c++14 -pthread -x c src/binary_semaphore.c -x c src/spi_proto.c -I. -Isrc/ -x c src/crc16.c -x c src/spi_remote_host.c -o click-test -g

#TODO can only run on linux
#blip-test: test/blip-test.cpp libspiproto.a spi_chunks.o test/test_util.o spi_proto_util.o
# #g++ $(CFLAGS) -o blip-test test/blip-test.cpp -std=c++14 -pthread spi_chunks.o test/test_util.o spi_proto_util.o -L. -lspiproto -I. -Isrc
# g++ test/blip-test.cpp src/spi_proto_master_datagram.cpp src/spi_chunks.cpp -std=c++14 -pthread -x c src/binary_semaphore.c -x c src/spi_proto.c -I. -Isrc/ -x c src/crc16.c -x c src/spi_remote_host.c -o blip-test -g
#these two can only be built on linux
add_executable(click-test EXCLUDE_FROM_ALL test/click-test.cpp src/spi_proto_master.cpp src/spi_chunks.cpp src/binary_semaphore.c src/spi_proto.c src/crc16.c src/spi_remote_host.c)
target_link_libraries(click-test spiproto pthread)
target_include_directories(click-test PUBLIC src/ PUBLIC test/)

add_executable(blip-test test/blip-test.cpp src/spi_proto_master_datagram.cpp src/spi_chunks.cpp src/binary_semaphore.c src/spi_proto.c src/crc16.c src/spi_remote_host.c)
target_link_libraries(blip-test spiproto pthread)
target_include_directories(blip-test PUBLIC src/ PUBLIC test/)
7 changes: 6 additions & 1 deletion test/blip-test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//g++ click-test.cpp spi_proto_master.cpp spi_proto_lib/spi_chunks.cpp -std=c++14 -pthread -x c binary_semaphore.c -x c spi_proto_lib/spi_proto.c -I. -Ispi_proto_lib/ -x c crc16.c -x c spi_remote_host.c -o click -g
//causes solenoids to click in strobing sequence. Remote API test
//use with HeartrateLED k66f code.
#include <thread>
#include "spi_datagram.h"

Expand All @@ -19,7 +19,12 @@ dummy_callback(struct spi_packet *p)
/* If we linked with this function and the k66f code simply echoed our
* messages, this would receive arguments where p->msg[0] was alternately 60
* and 120.
* Here we print out the received bytes in hex.
*/
for (int i = 0; i < sizeof(struct spi_packet); i++) {
printf("%02x ", ((unsigned char *)p)[i]);
}
puts("");
}
void (*spi_callback)(struct spi_packet *p) = dummy_callback;

Expand Down

0 comments on commit 5e6952d

Please sign in to comment.