diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-05 12:51:24 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-05 12:51:24 +0200 |
commit | a8b794c02574e96150d55852fa5db1ce7529503d (patch) | |
tree | cac16715745c58aa18b3c8fac8f058517ef234a9 /puzzle/dummy | |
parent | a96ffb4d0fd8576d753bb975b674b2aeef617d5f (diff) |
add arduino cmake toolchain + improve lazy.mk
Diffstat (limited to 'puzzle/dummy')
-rw-r--r-- | puzzle/dummy/CMakeLists.txt | 33 | ||||
l--------- | puzzle/dummy/lib | 1 | ||||
-rw-r--r-- | puzzle/dummy/main.cpp | 23 | ||||
-rw-r--r-- | puzzle/dummy/makefile | 7 |
4 files changed, 64 insertions, 0 deletions
diff --git a/puzzle/dummy/CMakeLists.txt b/puzzle/dummy/CMakeLists.txt new file mode 100644 index 0000000..026864b --- /dev/null +++ b/puzzle/dummy/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.29) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# enable debug features +set(CMAKE_BUILD_TYPE Debug) +add_compile_definitions(DEBUG) + +# arduino +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/lib/Arduino-CMake-Toolchain/Arduino-toolchain.cmake) +set(ARDUINO_BOARD "Arduino Uno [avr.uno]") + +project(pb_mod_dummy C CXX) + +include(../../shared/include.cmake) + +add_executable(main + main.cpp + ) + +# target_link_libraries(main +# puzbus +# # pbdrv-mod-arduino +# ) +target_link_arduino_libraries(main + core + Wire + ) + +target_enable_arduino_upload(main) + diff --git a/puzzle/dummy/lib b/puzzle/dummy/lib new file mode 120000 index 0000000..58677dd --- /dev/null +++ b/puzzle/dummy/lib @@ -0,0 +1 @@ +../../lib
\ No newline at end of file diff --git a/puzzle/dummy/main.cpp b/puzzle/dummy/main.cpp new file mode 100644 index 0000000..4374066 --- /dev/null +++ b/puzzle/dummy/main.cpp @@ -0,0 +1,23 @@ +#include <Arduino.h> +#include <Wire.h> + +void receiveEvent(int howMany){ + while (Wire.available()){ + char c = Wire.read(); + Serial.print(c, HEX); + } + Serial.println(); +} + +void setup() { + Wire.begin(0x00); + Wire.onReceive(receiveEvent); +} + +void loop() { + const uint8_t data[] = {0xff, 0x00, 0xde, 0xad, 0xbe, 0xef}; + Wire.beginTransmission(0x69); + Wire.write(data, sizeof(data)); + Wire.endTransmission(); +} + diff --git a/puzzle/dummy/makefile b/puzzle/dummy/makefile new file mode 100644 index 0000000..a971dfb --- /dev/null +++ b/puzzle/dummy/makefile @@ -0,0 +1,7 @@ +TARGET = $(BUILD_DIR)/main.elf + +include ../../lazy.mk + +export SERIAL_PORT = /dev/ttyACM0 +flash: upload-main; + |