From 36a8f66aeee73e82f28b040ca304e55034f05644 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 5 Jun 2024 14:49:34 +0200 Subject: arduino specific puzzle bus driver test --- puzzle/dummy/CMakeLists.txt | 9 ++++----- puzzle/dummy/main.cpp | 20 +++++++------------- 2 files changed, 11 insertions(+), 18 deletions(-) (limited to 'puzzle') diff --git a/puzzle/dummy/CMakeLists.txt b/puzzle/dummy/CMakeLists.txt index 026864b..acc567c 100644 --- a/puzzle/dummy/CMakeLists.txt +++ b/puzzle/dummy/CMakeLists.txt @@ -14,16 +14,15 @@ set(ARDUINO_BOARD "Arduino Uno [avr.uno]") project(pb_mod_dummy C CXX) -include(../../shared/include.cmake) +include(../../shared/pb.cmake) add_executable(main main.cpp ) -# target_link_libraries(main -# puzbus -# # pbdrv-mod-arduino -# ) +target_link_libraries(main + pbdrv-mod + ) target_link_arduino_libraries(main core Wire diff --git a/puzzle/dummy/main.cpp b/puzzle/dummy/main.cpp index 4374066..edcc587 100644 --- a/puzzle/dummy/main.cpp +++ b/puzzle/dummy/main.cpp @@ -1,23 +1,17 @@ #include #include -void receiveEvent(int howMany){ - while (Wire.available()){ - char c = Wire.read(); - Serial.print(c, HEX); - } - Serial.println(); -} +#include "pb/drv/arduino/mod.h" + +const char * PBDRV_MOD_NAME = "dummy"; +const i2c_addr_t PBDRV_MOD_ADDR = 0x20; void setup() { - Wire.begin(0x00); - Wire.onReceive(receiveEvent); + pbdrv_setup(); } void loop() { - const uint8_t data[] = {0xff, 0x00, 0xde, 0xad, 0xbe, 0xef}; - Wire.beginTransmission(0x69); - Wire.write(data, sizeof(data)); - Wire.endTransmission(); + pbdrv_i2c_send(0x00, (uint8_t *) "hoi", 3); + delay(100); } -- cgit v1.2.3