How to use a function from an Arduino sketch in a library? - RadioHead Library

Thread Starter

ElazarM

Joined Aug 10, 2021
1
Summary:
Basically, I am trying to use the RadioHead library while using an I2C IO expander pin for the chip select pin of the RF module,
so I edited the RadioHead library to use a function placed in the Arduino sketch folder,
instead of the original digitalWrite(CC, LOW)... I use my own function I2C_IO_Write(CC, LOW);...

However, the library I have created and placed in the Arduino sketch folder does not link with the Arduino library... in my case the RadioHead library.

Question:
is there a way to use in an Arduino library a function that is inside a .h file in the sketch folder?

Note:
using the full path doesn't work, I am having a hard time understanding how the Arduino build system links all the stuff together...
 

Ian Rogers

Joined Dec 12, 2012
933
C++ compilers are very intelligent.. Just using 1 function will only link 1 function from said library... Its safer to just include the library and just call that function.. However! if you are saying that the library function calls an inbuilt IO routine that you don't want, then you can overload that function by a simple class.. But here's where it gets tricksy.. finding the relevent class to overload..

So..You may need to write your own little library.. Is there an issue with digitalWrite??
 

trebla

Joined Jun 29, 2019
457
To avoid ruinning working (common) libraries is better to copy library files to another folder and customise these files after that.
 
Top