diff options
Diffstat (limited to 'shared/pb/drv/arduino')
-rw-r--r-- | shared/pb/drv/arduino/mod.cpp | 33 | ||||
-rw-r--r-- | shared/pb/drv/arduino/mod.h | 19 |
2 files changed, 0 insertions, 52 deletions
diff --git a/shared/pb/drv/arduino/mod.cpp b/shared/pb/drv/arduino/mod.cpp deleted file mode 100644 index c7bbe45..0000000 --- a/shared/pb/drv/arduino/mod.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef ARDUINO -#error This driver only works on the Arduino platform! -#endif - -#include <Arduino.h> -#include <Wire.h> - -#include <stdlib.h> -#include <stdint.h> - -#include "mod.h" - -static void recv_event(int bytes) { - uint8_t * data = (uint8_t *) malloc(bytes); - size_t size = 0; - while (Wire.available()) { - data[size++] = Wire.read(); - } - - pbdrv_i2c_recv(data, size); -} - -void pbdrv_setup() { - Wire.begin((int) PBDRV_MOD_ADDR); - Wire.onReceive(recv_event); -} - -__weak void pbdrv_i2c_send(i2c_addr_t addr, const uint8_t * buf, size_t sz) { - Wire.beginTransmission((int) addr); - Wire.write(buf, sz); - Wire.endTransmission(); -} - diff --git a/shared/pb/drv/arduino/mod.h b/shared/pb/drv/arduino/mod.h deleted file mode 100644 index e2e3b6d..0000000 --- a/shared/pb/drv/arduino/mod.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "../../moddrv.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief puzzle bus driver setup - * - * This function should be called from the Arduino \c setup() function. - */ -void pbdrv_setup(); - -#ifdef __cplusplus -} -#endif - |