aboutsummaryrefslogtreecommitdiff
path: root/lib/pbdrv/drv
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-26 13:11:54 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-26 13:11:54 +0200
commitad3e4f50ab83036ab974b4f30295c873dac3c7f0 (patch)
tree344531a2411259395762c7ac91c802cafd090b92 /lib/pbdrv/drv
parentf35e4886d4036a90617305003959b8b9e6b62f43 (diff)
no more undocumented things
Diffstat (limited to 'lib/pbdrv/drv')
-rw-r--r--lib/pbdrv/drv/arduino/mod.cpp6
-rw-r--r--lib/pbdrv/drv/index.dox7
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/pbdrv/drv/arduino/mod.cpp b/lib/pbdrv/drv/arduino/mod.cpp
index 581b80a..81735af 100644
--- a/lib/pbdrv/drv/arduino/mod.cpp
+++ b/lib/pbdrv/drv/arduino/mod.cpp
@@ -47,11 +47,11 @@ static void pb_setup() {
* with 2 Uno's, but ran into issues while integrating the Arduino's with the
* RP2040.
*/
-__weak void pb_i2c_send(i2c_addr_t addr, const uint8_t * buf, size_t sz) {
- if (pb_hook_i2c_send(addr, buf, sz)) return;
+__weak void pb_i2c_send(i2c_addr_t i2c_addr, const uint8_t * buf, size_t sz) {
+ if (pb_hook_i2c_send(i2c_addr, buf, sz)) return;
vTaskDelay(10 / portTICK_PERIOD_MS); // prevent bus collisions
- Wire.beginTransmission((int) addr);
+ Wire.beginTransmission((int) i2c_addr);
Wire.write(buf, sz);
Wire.endTransmission(true);
Wire.setWireTimeout(PB_TIMEOUT_US, true);
diff --git a/lib/pbdrv/drv/index.dox b/lib/pbdrv/drv/index.dox
index 89b9247..c0c1b76 100644
--- a/lib/pbdrv/drv/index.dox
+++ b/lib/pbdrv/drv/index.dox
@@ -8,12 +8,17 @@ Like \ref pb_ext "extensions", drivers provide platform-specific
implementations for various functions used in \ref pbdrv-mod.
If there is no existing driver for your target, you may implement the following
-in order to use \ref pbdrv-mod:
+in order to use \ref "pbdrv-mod":
- The \c pb_i2c_recv() function must be **called** for every received I2C
message
- The \c pb_i2c_send() function must be **implemented** using the
platform/device-specific I2C write function
+ \note The \c pb_i2c_send() function should immediately call \c
+ pb_hook_i2c_send() before doing any further processing:
+ ```c
+ if (pb_hook_i2c_send(i2c_addr, buf, sz)) return;
+ ```
*/