Teensy 4.1 Volvo IDM HELP!

Hello everyone!

I am not great at the whole C++ Coding aspect. I am keen to learn too! However. I am wading my way through how to tap into the display module on my Volvo C30. So I can overlay the image data on a Raspberry Pi to make my own audio/ Climate control interface for my car.
I see that someone has already semi-done this.
link.

Straight away, I know that this is for a much older version and I am trying to run it on. But I see that other people have nearly sussed this out too.

link

I have been on this all day and I simply cannot get it to compile.

This is what I've got.

#include "referenceBmp.h"
#ifdef PRINT_DEBUG
#endif

#define PinInt 12

#define data0 2
#define data1 14
#define data2 7
#define data3 8
#define data4 6
#define data5 20
#define data6 21
#define data7 5

void setup(){

Serial.begin(115200);

pinMode(ClkPin, INPUT); // sets the digital pin as input : CLK

pinMode(data0, INPUT); // sets the digital pin as input : D0
pinMode(data1, INPUT); // sets the digital pin as input : D1
pinMode(data2, INPUT); // sets the digital pin as input : D2
pinMode(data3, INPUT); // sets the digital pin as input : D3
pinMode(data4, INPUT); // sets the digital pin as input : D4
pinMode(data5, INPUT); // sets the digital pin as input : D5
pinMode(data6, INPUT); // sets the digital pin as input : D6
pinMode(data7, INPUT); // sets the digital pin as input : D7

attachInterrupt(ClkPin, isrService, FALLING); // data ready
NVIC_SET_PRIORITY(IRQ_GPIO6789, 0);

//wait opening com port on pc side
while(!Serial);
Serial.println(__DATE__);
Serial.println(__TIME__);
Serial.print("Arduino Ide Version ");
Serial.print(ARDUINO, DEC);
Serial.println("");
Serial.print("Teensyduino Version ");
Serial.print(TEENSYDUINO, DEC);
Serial.println("");
Serial.print("Cpu frequency ");
Serial.print(F_CPU, DEC);
Serial.println("");
}

#define DATABUFFER_SIZE_2048  (2048)
#define DATABUFFER_SIZE_2096  (2096)
#define DATABUFFER_SIZE DATABUFFER_SIZE_2048
extern volatile unsigned char newDataIsr[DATABUFFER_SIZE];
extern volatile unsigned char dataReadyIsr;
extern const unsigned char protocolFound;
#ifdef PRINT_DEBUG
extern volatile unsigned int startFound;
#endif

#define NB_COLUMNS_32 32
#define NB_ROWS_64 64
#define PIXEL_DATA_SIZE_2048 (NB_ROWS_64*NB_COLUMNS_32)
unsigned char bmpData[PIXEL_DATA_SIZE_2048];

#define COLUMN_SIZE_8 8

char bmpDataReady = 0;

void bmpDataBuild(void)
{
  unsigned int i = 0;
  unsigned int j = 0;
  unsigned int k = 0;
  unsigned int pixelStart = 0;
  unsigned int pixelXOffset = 0;
  unsigned int pixelYOffset = 0;
  unsigned char tmp = 0;

  bmpDataReady = 0;

  for(i = 0; i < PIXEL_DATA_SIZE_2048; i++)
  {
    bmpData[i] = 0;
  }

  //remove 3 bytes every 128 bytes
  if(protocolFound)
  {
    for(i = 0; i < DATABUFFER_SIZE_2096; i++)
    {
      if(!(i%128))
      {
        for(j = 0; j < (DATABUFFER_SIZE_2096 - i); j++)
        {
          newDataIsr[i+j] = newDataIsr[i+j+3];
        }
      }
    }
  }

  //start at bottom end
  pixelStart += (PIXEL_DATA_SIZE_2048 - (NB_COLUMNS_32 * COLUMN_SIZE_8));
    
  for(i = 0; i < PIXEL_DATA_SIZE_2048; i++)
  {
    for(j = 0; j < COLUMN_SIZE_8; j++)
    {
      cli();
      bmpData[i] |= (((newDataIsr[pixelStart + pixelXOffset] & (0x80 >> pixelYOffset)) >> ((COLUMN_SIZE_8 - 1) - pixelYOffset)) << ((COLUMN_SIZE_8 - 1) - j));
      sei();
      pixelXOffset++;
      if(pixelXOffset >= (NB_COLUMNS_32 * COLUMN_SIZE_8))
      {
        pixelXOffset = 0;
        pixelYOffset++;
        if(pixelYOffset >= COLUMN_SIZE_8)
        {
          pixelYOffset = 0;
          pixelStart -=(NB_COLUMNS_32 * COLUMN_SIZE_8);
        }
      }
    }
  }

  
  if(protocolFound)
  {
#if 1
    //1st pass
    j = ((32*32)+16);
    for(k = 0; k < 32; k++)
    {
      for(i = (32*k); i < (32*k)+16; i++)
      {
        tmp = bmpData[i+j];
        bmpData[i+j] = bmpData[i];
        bmpData[i] = tmp;
      }
    }
#endif
#if 1
    //2nd pass
    j = 32*32;
    for(k = 0; k < 8; k++)
    {
      for(i = (32*k); i < (32*k)+32; i++)
      {
        tmp = bmpData[i+j];
        bmpData[i+j] = bmpData[i+(32*8)];
        bmpData[i+(32*8)] = tmp;
      }
    }
#endif
#if 1
    //3rd pass
    j = 32*32;
    for(k = 0; k < 8; k++)
    {
      for(i = (32*k); i < (32*k)+32; i++)
      {
        tmp = bmpData[i+j];
        bmpData[i+j] = bmpData[i+(32*16)];
        bmpData[i+(32*16)] = tmp;
      }
    }
#endif
#if 1
    //4th pass
    j = 32*40;
    for(k = 0; k < 8; k++)
    {
      for(i = (32*k); i < (32*k)+32; i++)
      {
        tmp = bmpData[i+j];
        bmpData[i+j] = bmpData[i+(32*24)];
        bmpData[i+(32*24)] = tmp;
      }
    }
#endif
#if 1
    //5th pass
    j = 32*48;
    for(k = 0; k < 8; k++)
    {
      for(i = (32*k); i < (32*k)+32; i++)
      {
        tmp = bmpData[i+j];
        bmpData[i+j] = bmpData[i+(32*40)];
        bmpData[i+(32*40)] = tmp;
      }
    }
#endif
  }

  bmpDataReady = 1;
}

//1Bit 256*64 BMP file header
#define BMP_HEADER_SIZE_62 62
const unsigned char bmpHeader[BMP_HEADER_SIZE_62]={
  0x42,0x4D,0x3E,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x28,0x00,
  0x00,0x00,0x00,0x01,0x00,0x00,0x40,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,
  0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00
};
#define BMP_FILE_SIZE_2110 (BMP_HEADER_SIZE_62 + PIXEL_DATA_SIZE_2048)
unsigned char bmpFile[BMP_FILE_SIZE_2110];

char bmpFileReady = 0;

void bmpFileBuild(void)
{
  unsigned int i = 0;

  bmpFileReady = 0;

  if(bmpDataReady)
  {
    //1 - Header first
    for(i = 0; i < BMP_HEADER_SIZE_62; i++)
    {
      bmpFile[i] = bmpHeader[i];
    }
    //2 - Then pixel data, bottom to top aligned
    for(i = BMP_HEADER_SIZE_62; i < BMP_FILE_SIZE_2110; i++)
    {
      bmpFile[i] = bmpData[i-BMP_HEADER_SIZE_62];
    }
    bmpFileReady = 1;
  }
}

void loop()
{
// int incomingByte = 0;   // for incoming serial data
  unsigned int i = 0;
#ifdef PRINT_DEBUG
  unsigned char minRef = 100;
  unsigned char maxRef = 0;
  unsigned char currentRef = 0;
  unsigned int errors = 0;
  unsigned int nbNoError = 0;
#endif

  while(1)
  {
//    if (Serial.available() > 0)
//    {
//      // read the incoming byte:
//      incomingByte = Serial.read();
//
//      if(incomingByte == 'b')
//      {
//        bmpDataReady = 0;
//        bmpFileReady = 0;
//        dataReadyIsr = 0;
//      }
//    }

    delay(100);

    if(bmpFileReady == 0)
    {
      if(dataReadyIsr)
      {
        bmpDataBuild();
        bmpFileBuild();
      }
    }
    if(bmpFileReady == 1)
    {
      bmpFileReady = 2;

      //wait opening com port on pc side
      while(!Serial);
      
#ifndef PRINT_DEBUG
      for(i = 0; i < BMP_FILE_SIZE_2110; i++)
      {
        //print extra zero if less than two chars
        if(bmpFile[i] < 0x10) Serial.print("0");
        Serial.print(bmpFile[i], HEX);
        //compare with a reference file
        //if(bmpFile[i] != referenceBmp[i]) errors++;
      }
      Serial.println("");
#endif

#ifdef PRINT_DEBUG
/*      for(i = 0; i < 2048; i++)
      {
        if(newDataIsr[i] < 0x10) Serial.print("0");
        Serial.print(newDataIsr[i], HEX);
      }
      Serial.println("");
*/
/*
      //stats about errors between current file and reference file
      currentRef = 100 - ((errors * 100) / BMP_FILE_SIZE_2110);
      if(currentRef < minRef) minRef = currentRef;
      if(currentRef > maxRef) maxRef = currentRef;
      if(currentRef == 100) nbNoError++;

      Serial.println("MIN<CUR<MAX NBNOERR NBSTART");
      Serial.print(minRef, DEC);
      Serial.print(" ");
      Serial.print(currentRef, DEC);
      Serial.print(" ");
      Serial.print(maxRef, DEC);
      Serial.print("  ");
      Serial.print(nbNoError, DEC);
      Serial.print("    ");
*/
      Serial.println("NBSTART startFound");
      Serial.print(startFound, DEC);
      Serial.print(" ");
      Serial.print(startFound, DEC);
      Serial.println("");

      errors = 0;
#endif

      bmpDataReady = 0;
      bmpFileReady = 0;
      dataReadyIsr = 0;
    }
  }
}

// watermark generates this interrupt
FASTRUN inline void isrService()
{
}```

But when I try to compile it, I get a whole host of errors...

C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\sketch_dec3a.ino: In function 'void setup()':
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\sketch_dec3a.ino:24:9: error: 'ClkPin' was not declared in this scope
   24 | pinMode(ClkPin, INPUT); // sets the digital pin as input : CLK
      |         ^~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino: At global scope:
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:192:6: error: redefinition of 'void attachInterruptVector(IRQ_NUMBER_t, void (*)())'
  192 | void attachInterruptVector(enum IRQ_NUMBER_t irq, void (*function)(void))
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\james\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\cores\teensy4/core_pins.h:32,
                 from C:\Users\james\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\cores\teensy4/wiring.h:39,
                 from C:\Users\james\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\cores\teensy4/WProgram.h:46,
                 from C:\Users\james\AppData\Local\Temp\arduino\sketches\E50839B664744489CFBE0D0A7C467024\pch\Arduino.h:6:
C:\Users\james\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\cores\teensy4/imxrt.h:436:20: note: 'void attachInterruptVector(IRQ_NUMBER_t, void (*)())' previously defined here
  436 | static inline void attachInterruptVector(IRQ_NUMBER_t irq, void (*function)(void)) { _VectorsRam[irq + 16] = function; asm volatile("": : :"memory"); }
      |                    ^~~~~~~~~~~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino: In function 'void attachInterrupt(uint8_t, void (*)(), int)':
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:200:18: warning: unused variable 'cfg' [-Wunused-variable]
  200 |         uint32_t cfg, mask;
      |                  ^~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino: In function 'void _init_Teensyduino_internal_()':
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:605:9: error: 'FTM0_CNT' was not declared in this scope
  605 |         FTM0_CNT = 0;
      |         ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:606:9: error: 'FTM0_MOD' was not declared in this scope
  606 |         FTM0_MOD = DEFAULT_FTM_MOD;
      |         ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:606:20: error: 'DEFAULT_FTM_MOD' was not declared in this scope
  606 |         FTM0_MOD = DEFAULT_FTM_MOD;
      |                    ^~~~~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:607:9: error: 'FTM0_C0SC' was not declared in this scope
  607 |         FTM0_C0SC = 0x28; // MSnB:MSnA = 10, ELSnB:ELSnA = 10
      |         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:608:9: error: 'FTM0_C1SC' was not declared in this scope
  608 |         FTM0_C1SC = 0x28;
      |         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:609:9: error: 'FTM0_C2SC' was not declared in this scope
  609 |         FTM0_C2SC = 0x28;
      |         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:610:9: error: 'FTM0_C3SC' was not declared in this scope
  610 |         FTM0_C3SC = 0x28;
      |         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:611:9: error: 'FTM0_C4SC' was not declared in this scope
  611 |         FTM0_C4SC = 0x28;
      |         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:612:9: error: 'FTM0_C5SC' was not declared in this scope
  612 |         FTM0_C5SC = 0x28;
      |         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:627:9: error: 'FTM0_SC' was not declared in this scope
  627 |         FTM0_SC = FTM_SC_CLKS(1) | FTM_SC_PS(DEFAULT_FTM_PRESCALE);
      |         ^~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:627:19: error: 'FTM_SC_CLKS' was not declared in this scope
  627 |         FTM0_SC = FTM_SC_CLKS(1) | FTM_SC_PS(DEFAULT_FTM_PRESCALE);
      |                   ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:627:46: error: 'DEFAULT_FTM_PRESCALE' was not declared in this scope
  627 |         FTM0_SC = FTM_SC_CLKS(1) | FTM_SC_PS(DEFAULT_FTM_PRESCALE);
      |                                              ^~~~~~~~~~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:627:36: error: 'FTM_SC_PS' was not declared in this scope
  627 |         FTM0_SC = FTM_SC_CLKS(1) | FTM_SC_PS(DEFAULT_FTM_PRESCALE);
      |                                    ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:628:9: error: 'FTM1_CNT' was not declared in this scope
  628 |         FTM1_CNT = 0;
      |         ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:629:9: error: 'FTM1_MOD' was not declared in this scope
  629 |         FTM1_MOD = DEFAULT_FTM_MOD;
      |         ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:630:9: error: 'FTM1_C0SC' was not declared in this scope
  630 |         FTM1_C0SC = 0x28;
      |         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:631:9: error: 'FTM1_C1SC' was not declared in this scope
  631 |         FTM1_C1SC = 0x28;
      |         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:632:9: error: 'FTM1_SC' was not declared in this scope
  632 |         FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(DEFAULT_FTM_PRESCALE);
      |         ^~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino: In function 'void analogWrite(uint8_t, int)':
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:807:24: warning: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'long unsigned int'} [-Wsign-compare]
  807 |         } else if (val >= max) {
      |                    ~~~~^~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:820:20: error: 'FTM1_CH0_PIN' was not declared in this scope
  820 |         if (pin == FTM1_CH0_PIN || pin == FTM1_CH1_PIN) {
      |                    ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:820:43: error: 'FTM1_CH1_PIN' was not declared in this scope
  820 |         if (pin == FTM1_CH0_PIN || pin == FTM1_CH1_PIN) {
      |                                           ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:821:52: error: 'FTM1_MOD' was not declared in this scope
  821 |                 cval = ((uint32_t)val * (uint32_t)(FTM1_MOD + 1)) >> analog_write_res;
      |                                                    ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:837:52: error: 'FTM0_MOD' was not declared in this scope
  837 |                 cval = ((uint32_t)val * (uint32_t)(FTM0_MOD + 1)) >> analog_write_res;
      |                                                    ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino: In function 'void analogWriteFrequency(uint8_t, float)':
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1018:33: error: 'F_TIMER' was not declared in this scope
 1018 |         if (frequency < (float)(F_TIMER >> 7) / 65536.0f) {
      |                                 ^~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1044:20: error: 'FTM1_CH0_PIN' was not declared in this scope
 1044 |         if (pin == FTM1_CH0_PIN || pin == FTM1_CH1_PIN) {
      |                    ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1044:43: error: 'FTM1_CH1_PIN' was not declared in this scope
 1044 |         if (pin == FTM1_CH0_PIN || pin == FTM1_CH1_PIN) {
      |                                           ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1045:17: error: 'FTM1_SC' was not declared in this scope
 1045 |                 FTM1_SC = 0;
      |                 ^~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1046:17: error: 'FTM1_CNT' was not declared in this scope
 1046 |                 FTM1_CNT = 0;
      |                 ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1047:17: error: 'FTM1_MOD' was not declared in this scope
 1047 |                 FTM1_MOD = mod;
      |                 ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1048:27: error: 'FTM_SC_CLKS' was not declared in this scope
 1048 |                 FTM1_SC = FTM_SC_CLKS(ftmClockSource) | FTM_SC_PS(prescale);    //Use ftmClockSource instead of 1
      |                           ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1048:57: error: 'FTM_SC_PS' was not declared in this scope
 1048 |                 FTM1_SC = FTM_SC_CLKS(ftmClockSource) | FTM_SC_PS(prescale);    //Use ftmClockSource instead of 1
      |                                                         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1049:27: error: 'FTM0_CH0_PIN' was not declared in this scope
 1049 |         } else if (pin == FTM0_CH0_PIN || pin == FTM0_CH1_PIN
      |                           ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1049:50: error: 'FTM0_CH1_PIN' was not declared in this scope
 1049 |         } else if (pin == FTM0_CH0_PIN || pin == FTM0_CH1_PIN
      |                                                  ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1050:21: error: 'FTM0_CH2_PIN' was not declared in this scope
 1050 |           || pin == FTM0_CH2_PIN || pin == FTM0_CH3_PIN
      |                     ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1050:44: error: 'FTM0_CH3_PIN' was not declared in this scope
 1050 |           || pin == FTM0_CH2_PIN || pin == FTM0_CH3_PIN
      |                                            ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1051:21: error: 'FTM0_CH4_PIN' was not declared in this scope
 1051 |           || pin == FTM0_CH4_PIN || pin == FTM0_CH5_PIN
      |                     ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1051:44: error: 'FTM0_CH5_PIN' was not declared in this scope
 1051 |           || pin == FTM0_CH4_PIN || pin == FTM0_CH5_PIN
      |                                            ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1056:17: error: 'FTM0_SC' was not declared in this scope
 1056 |                 FTM0_SC = 0;
      |                 ^~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1057:17: error: 'FTM0_CNT' was not declared in this scope
 1057 |                 FTM0_CNT = 0;
      |                 ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1058:17: error: 'FTM0_MOD' was not declared in this scope
 1058 |                 FTM0_MOD = mod;
      |                 ^~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1059:27: error: 'FTM_SC_CLKS' was not declared in this scope
 1059 |                 FTM0_SC = FTM_SC_CLKS(ftmClockSource) | FTM_SC_PS(prescale);    //Use ftmClockSource instead of 1
      |                           ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1059:57: error: 'FTM_SC_PS' was not declared in this scope
 1059 |                 FTM0_SC = FTM_SC_CLKS(ftmClockSource) | FTM_SC_PS(prescale);    //Use ftmClockSource instead of 1
      |                                                         ^~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino: In function 'void digitalWrite(uint8_t, uint8_t)':
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1116:37: error: 'PORT_PCR_PE' was not declared in this scope
 1116 |                         *config |= (PORT_PCR_PE | PORT_PCR_PS);
      |                                     ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1116:51: error: 'PORT_PCR_PS' was not declared in this scope
 1116 |                         *config |= (PORT_PCR_PE | PORT_PCR_PS);
      |                                                   ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1120:38: error: 'PORT_PCR_PE' was not declared in this scope
 1120 |                         *config &= ~(PORT_PCR_PE);
      |                                      ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino: In function 'void pinMode(uint8_t, uint8_t)':
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1152:27: error: 'PORT_PCR_SRE' was not declared in this scope
 1152 |                 *config = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
      |                           ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1152:42: error: 'PORT_PCR_DSE' was not declared in this scope
 1152 |                 *config = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
      |                                          ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1152:57: error: 'PORT_PCR_MUX' was not declared in this scope
 1152 |                 *config = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
      |                                                         ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1154:32: error: 'PORT_PCR_ODE' was not declared in this scope
 1154 |                     *config |= PORT_PCR_ODE;
      |                                ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1156:33: error: 'PORT_PCR_ODE' was not declared in this scope
 1156 |                     *config &= ~PORT_PCR_ODE;
      |                                 ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1165:35: error: 'PORT_PCR_MUX' was not declared in this scope
 1165 |                         *config = PORT_PCR_MUX(1);
      |                                   ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1167:35: error: 'PORT_PCR_MUX' was not declared in this scope
 1167 |                         *config = PORT_PCR_MUX(1) | PORT_PCR_PE | PORT_PCR_PS;
      |                                   ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1167:53: error: 'PORT_PCR_PE' was not declared in this scope
 1167 |                         *config = PORT_PCR_MUX(1) | PORT_PCR_PE | PORT_PCR_PS;
      |                                                     ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1167:67: error: 'PORT_PCR_PS' was not declared in this scope
 1167 |                         *config = PORT_PCR_MUX(1) | PORT_PCR_PE | PORT_PCR_PS;
      |                                                                   ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1169:35: error: 'PORT_PCR_MUX' was not declared in this scope
 1169 |                         *config = PORT_PCR_MUX(1) | PORT_PCR_PE;
      |                                   ^~~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:1169:53: error: 'PORT_PCR_PE' was not declared in this scope
 1169 |                         *config = PORT_PCR_MUX(1) | PORT_PCR_PE;
      |                                                     ^~~~~~~~~~~
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino: At global scope:
C:\Users\james\AppData\Local\Temp\.arduinoIDE-unsaved2023113-15740-1eayfqr.42v4\sketch_dec3a\extra_code.ino:144:13: warning: 'void dummy_isr()' defined but not used [-Wunused-function]
  144 | static void dummy_isr() {};
      |             ^~~~~~~~~

exit status 1

Compilation error: 'ClkPin' was not declared in this scope

I am begging anyone here for help. Even a pointer in the right direction would be amazing!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.