From 08989ff6fa615672938df2de9233af87d074da85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 10 Jun 2022 12:28:32 +0200 Subject: [PATCH] Allow SPItransfer to be overridden by subclasses This allows API clients to provide 'smarter' versions of Module that can do things like add thread safety so that multiple devices (and service threads) can share the same SPI bus. i.e. a subclass would lock some sort of mutex. This is used in the Radiolib Fork for Meshtastic to share an SPI bus with SD Card and TFT Display but we want to move back to upstream and not maintain our own fork. --- src/Module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module.h b/src/Module.h index 3a7b098d..2492c1a4 100644 --- a/src/Module.h +++ b/src/Module.h @@ -190,7 +190,7 @@ class Module { \param numBytes Number of bytes to transfer. */ - void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes); + virtual void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes); // pin number access methods