From b9599d6cbaf924b2c9f73511d5c7604ed57a755d Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 15 Jun 2024 14:15:36 +0200 Subject: compiling works again :cry: --- lib/pbdrv/drv/arduino/mod.cpp | 39 ++++++++++++++++++++++----------------- lib/pbdrv/drv/arduino/mod.h | 22 ---------------------- 2 files changed, 22 insertions(+), 39 deletions(-) delete mode 100644 lib/pbdrv/drv/arduino/mod.h (limited to 'lib') diff --git a/lib/pbdrv/drv/arduino/mod.cpp b/lib/pbdrv/drv/arduino/mod.cpp index d281495..21834d9 100644 --- a/lib/pbdrv/drv/arduino/mod.cpp +++ b/lib/pbdrv/drv/arduino/mod.cpp @@ -16,11 +16,6 @@ #include "../../pb.h" #include "../../pb-mod.h" #include "../../pb-buf.h" -#include "mod.h" - -//! Arduino setup function -extern void setup(void); -void loop(void) {} static void async_pb_i2c_recv(void * _msg, uint32_t _) { pb_buf_t * msg = (pb_buf_t *) _msg; @@ -48,18 +43,6 @@ static void pb_setup() { Wire.onReceive(recv_event); } -void initVariant(void) { - // call regular arduino setup - setup(); - Serial.print("regular setup done and in initVariant\r\n"); // DEBUG - - // call pbdrv-mod setup - pb_setup(); - - // start freertos scheduler - vTaskStartScheduler(); -} - __weak void pb_i2c_send(i2c_addr_t addr, const uint8_t * buf, size_t sz) { Wire.beginTransmission((int) addr); Wire.write(buf, sz); @@ -67,3 +50,25 @@ __weak void pb_i2c_send(i2c_addr_t addr, const uint8_t * buf, size_t sz) { Wire.setWireTimeout(PB_TIMEOUT_US, true); } +//! Arduino setup function +extern void setup(void); +//! Arduino internal initialization +void init(void); + +//! Application entrypoint +int main(void) { + init(); // call arduino internal setup + setup(); // call regular arduino setup + pb_setup(); // call pbdrv-mod setup + vTaskStartScheduler(); // start freertos scheduler + return 0; +} + +/** + * \note I should really be able to use Arduino's initVariant function for + * this, but I can't seem to get it to link properly using the CMake setup in + * this repository. Overriding the main() function seems to work, and the + * USBCON thing in the default Arduino main() function isn't needed because + * puzzle modules are likely not using USB. + */ + diff --git a/lib/pbdrv/drv/arduino/mod.h b/lib/pbdrv/drv/arduino/mod.h deleted file mode 100644 index 87b5724..0000000 --- a/lib/pbdrv/drv/arduino/mod.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -//! Arduino init variant (called before user setup) -void initVariant(void); - -/** - * \brief Arduino loop function - * - * Loop won't run because everything is handled by the freertos scheduler. It - * is defined in this driver to cause compiler warnings if the user has defined - * the loop() function anyways. - */ -extern void loop(void); - -#ifdef __cplusplus -} -#endif - -- cgit v1.2.3