aboutsummaryrefslogtreecommitdiff
path: root/puzzle
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-05 14:49:34 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-05 14:49:34 +0200
commit36a8f66aeee73e82f28b040ca304e55034f05644 (patch)
treecbd29649bf24c39415fca55eb4175fbf288f6f37 /puzzle
parenta8b794c02574e96150d55852fa5db1ce7529503d (diff)
arduino specific puzzle bus driver test
Diffstat (limited to 'puzzle')
-rw-r--r--puzzle/dummy/CMakeLists.txt9
-rw-r--r--puzzle/dummy/main.cpp20
2 files changed, 11 insertions, 18 deletions
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 <Arduino.h>
#include <Wire.h>
-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);
}