I am getting a conflict between two libraries, and I need both of them in a larger program.
Board is a RobotDyn MEGA2560
IDE is 1.8.10
The libraries were installed by the Library Manager and links from the More info are:
SD.h. SD.h
DigitalIO.h DigitalIO (greiman with fastPinMode fix)
// The ATmega2560 in the Mega2560 has larger memory space :
// Flash 256k bytes (of which 8k is used for the bootloader)
// SRAM 8k bytes
// EEPROM 4k byte
//-------------------------------------------------------------------------
// Libraries used
//-------------------------------------------------------------------------
#include <SD.h>
#include <DigitalIO.h>
//
//-------------------------------------------------------------------------
// Communications and SD Global Variables and compiler directives
//-------------------------------------------------------------------------
// uncomment DEBUGH to include hardware debugging
// The arduino shield uses pins 38, 39, 40 to read buttons and write LEDS
// Connecting the jumpers below and uncomming DEBUGH all the shield to simulate testing
// Pin 41 is used as the select line to STB to chose Lights (high) or Buttons (low)
// UNPLUG CONNECTOR
// Jumpers on shield
// -- Pin 41 (Digital Connector simulating STB Select) to Pin 4 High is LEDs, Low is Buttons
// -- Pin 40 (Digital Connector PG1 /RD simulating SCK Serial Clock) to Pin 1 CLK
// -- Pin 39 (Digital Connector PG2 ALE simulating MISO Master In Slave Out) to Pin 3 DATK is Buttons Input
// -- Pin 38 (Digital Connector PD7 simulating MOSI Master Out Slave In) to Pin 2 DATA is LEDs Output
//
//#define DEBUG_STB_PIN (uint8_t) 41
//#define DEBUG_SPI_MOSI_PIN (uint8_t) 38
//#define DEBUG_SPI_MISO_PIN (uint8_t) 39
//#define DEBUG_SPI_SCK_PIN (uint8_t) 40
//#define DEBUG_SPI_MODE (uint8_t) 2
const uint8_t DEBUG_STB_PIN = 41; //
const uint8_t DEBUG_SPI_MOSI_PIN = 38; // PD7 TO OUTPUT
const uint8_t DEBUG_SPI_MISO_PIN = 39; // PG2 ALE INPUT
const uint8_t DEBUG_SPI_SCK_PIN = 40; // PG1 /RD OUTPUT
const uint8_t DEBUG_SPI_MODE = 2;
SoftSPI<DEBUG_SPI_MISO_PIN, DEBUG_SPI_MOSI_PIN, DEBUG_SPI_SCK_PIN, DEBUG_SPI_MODE> sspi;
unsigned long testPattern = 0xAAAAAAAA;
int K=0;
uint8_t BButtons = 255;
#define DEBUGHL 1
#define DEBUGHB 1
void setup() {
// Debug code when Arduino Shield is NOT plugged
// Only plugged into Arduino Shield
//
// Either DEBUGHL or DEBUGHB
#if defined(DEBUGHL) || defined(DEBUGHB)
// Initialization
pinMode(DEBUG_STB_PIN, OUTPUT);
digitalWrite(DEBUG_STB_PIN,LOW);
// SoftSPI sspi;
sspi.begin();
#endif
}
//-------------------------------------------------------------------------
// Main loop MAIN MAIN MAIN
//-------------------------------------------------------------------------
void loop() {
#ifdef DEBUGHL
testPattern = testPattern << 1; // Shift the 32 bit unsigned integer left 1 bit ie mul by 2 for next light
if (testPattern == 0) { // If we have shifted thru all the lights then start again
testPattern = 1;
}
#endif
//---------------------------------------------------------------------
// TEST CODE for Hardware
//---------------------------------------------------------------------
// Test method with shield hardware and hardware test jumpers AND NOT plugged
#if defined(DEBUGHL) || defined(DEBUGHB)
if (K>=350) {
// about once a second
// When STB is HIGH LIGHTS are being written to the Front Panel
// When STB is LOW Buttons are being read (Don't overwrite)
// aka NSTB is HIGH Buttons are being read (Don't overwrite)
// Interrupt and overwrite Buttons when STB goes HIGH (or NSTB goes Low)
// Assert the select for lights
digitalWrite(DEBUG_STB_PIN, HIGH); // This will also generate a Buttons Interrupt
//
#endif
#ifdef DEBUGHL
//
// Simulate sending lights to Front Panel
//
// turn on a different light and shift to prepare the next light.
Serial.print(F("Sndg lit tst pat "));
Serial.println(testPattern, HEX);
sspi.send(testPattern); // Simulate sending of lights
// The next rising edge of STB should generate an interrupt to read the Lights
#endif
#if defined(DEBUGHL) || defined(DEBUGHB)
// Assert the select for buttons
digitalWrite(DEBUG_STB_PIN, LOW);
//
#endif
#ifdef DEBUGHB
//
// Simulate reading of buttons
//
// Read the buttons
BButtons = (uint8_t)sspi.receive(); // Simulate reading
// Did we get any buttons? Should be only one zero bit
if (BButtons!=0 && BButtons != 255) {
// Print the buttons if any pushed
Serial.print(F("Sim Rd of Buttons="));
Serial.println(BButtons);
}
#endif
#if defined(DEBUGHL) || defined(DEBUGHB)
K=0;// Restart the ~1 second counter
}
K++; // Increment the ~1 second counter
#endif
delay(19);
}
//-------------------------------------------------------------------------
// End of Main Loop
//-------------------------------------------------------------------------
And here are the first few error codes:
In file included from /Users/rjj100/Documents/Arduino/libraries/DigitalIO/src/DigitalIO.h:31:0,
from /Users/rjj100/Documents/Arduino/Test_SoftSPI/Test_SoftSPI.ino:11:
/Users/rjj100/Documents/Arduino/libraries/DigitalIO/src/DigitalPin.h:47:6: error: ambiguating new declaration of 'void badPinNumber()'
void badPinNumber(void)
^~~~~~~~~~~~
In file included from /Users/rjj100/Documents/Arduino/libraries/SD/src/utility/Sd2Card.h:26:0,
from /Users/rjj100/Documents/Arduino/libraries/SD/src/utility/SdFat.h:29,
from /Users/rjj100/Documents/Arduino/libraries/SD/src/SD.h:20,
from /Users/rjj100/Documents/Arduino/Test_SoftSPI/Test_SoftSPI.ino:9:
/Users/rjj100/Documents/Arduino/libraries/SD/src/utility/Sd2PinMap.h:463:9: note: old declaration 'uint8_t badPinNumber()'
uint8_t badPinNumber(void)
^~~~~~~~~~~~
In file included from /Users/rjj100/Documents/Arduino/libraries/DigitalIO/src/DigitalIO.h:31:0,
from /Users/rjj100/Documents/Arduino/Test_SoftSPI/Test_SoftSPI.ino:11:
/Users/rjj100/Documents/Arduino/libraries/DigitalIO/src/DigitalPin.h: In function 'bool fastDigitalRead(uint8_t)':
/Users/rjj100/Documents/Arduino/libraries/DigitalIO/src/DigitalPin.h:127:6: error: ambiguating new declaration of 'bool fastDigitalRead(uint8_t)'
bool fastDigitalRead(uint8_t pin) {
^~~~~~~~~~~~~~~
In file included from /Users/rjj100/Documents/Arduino/libraries/SD/src/utility/Sd2Card.h:26:0,
from /Users/rjj100/Documents/Arduino/libraries/SD/src/utility/SdFat.h:29,
from /Users/rjj100/Documents/Arduino/libraries/SD/src/SD.h:20,
from /Users/rjj100/Documents/Arduino/Test_SoftSPI/Test_SoftSPI.ino:9:
/Users/rjj100/Documents/Arduino/libraries/SD/src/utility/Sd2PinMap.h:487:9: note: old declaration 'uint8_t fastDigitalRead(uint8_t)'
uint8_t fastDigitalRead(uint8_t pin) {
^~~~~~~~~~~~~~~