STM32 time interrupt

As I said I am trying to import in PlatformIo a Job for a drone YMFC-32. The job has been done for arduino Ide with the board manager for STM32 of Roger Clark. Ok I am more or less at the end of the job if some one is helping me in solving the two bug in this file

#include <Arduino.h>

void handler_channel_1(void);
void handler_channel_2(void);
void handler_channel_3(void);
void handler_channel_4(void);
void handler_channel_5(void);
void handler_channel_6(void);

int16_t loop_counter;
uint8_t data, start, warning;

int32_t channel_1_start, channel_1;
int32_t channel_2_start, channel_2;
int32_t channel_3_start, channel_3;
int32_t channel_4_start, channel_4;
int32_t channel_5_start, channel_5;
int32_t channel_6_start, channel_6;

//In this file the timers for reading the receiver pulses and for creating output ESC pulses are set.

void timer_setup(void) {
  TIMFR2,attachCompare1Interrupt(handler_channel_1);
  TIMER2.attachCompare2Interrupt(handler_channel_2);
  TIMER2.attachCompare3Interrupt(handler_channel_3);
  TIMER2.attachCompare4Interrupt(handler_channel_4);
  TIM2->CR1 = TIM_CR1_CEN;
  TIM2->CR2 = 0;
  TIM2->SMCR = 0;
  TIM2->DIER = TIM_DIER_CC1IE | TIM_DIER_CC2IE | TIM_DIER_CC3IE | TIM_DIER_CC4IE;
  TIM2->EGR = 0;
  TIM2->CCMR1 = 0b100000001; //Register is set l due to a bug in the define table (30-09-2017)
  TIM2->CCMR2 = 0b100000001; //Register is set l due to a bug in the define table (30-09-2017)
  TIM2->CCER = TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E;
  TIM2->PSC = 71;
  TIM2->ARR = 0xFFFF;
  TIM2->DCR = 0;

  TIMER3.attachCompare1Interrupt(handler_channel_5);
  TIMER3.attachCompare2Interrupt(handler_channel_6);
  TIM3->CR1 = TIM_CR1_CEN;
  TIM3->CR2 = 0;
  TIM3->SMCR = 0;
  TIM3->DIER = TIM_DIER_CC1IE | TIM_DIER_CC2IE;
  TIM3->EGR = 0;
  TIM3->CCMR1 = 0b100000001; //Register is set  due to a bug in the define table (30-09-2017)
  TIM3->CCMR2 = 0;
  TIM3->CCER = TIM_CCER_CC1E | TIM_CCER_CC2E;
  TIM3->PSC = 71;
  TIM3->ARR = 0xFFFF;
  TIM3->DCR = 0;

//A test is needed to check if the throttle input is active and valid. Otherwise the ESC's might start without any warning.
  loop_counter = 0;
  while ((channel_3 > 2100 || channel_3 < 900) && warning == 0) {
    delay(100);
    loop_counter++;
    if (loop_counter == 40) {
      Serial.println(F("Waiting for a valid receiver channel-3 input signal"));
      Serial.println(F(""));
      Serial.println(F("The input pulse should be between 1000 till 2000us"));
      Serial.print(F("Current channel-3 receiver input value = "));
      Serial.println(channel_3);
      Serial.println(F(""));
      Serial.println(F("Is the receiver connected and the transmitter on?"));
      Serial.println(F("For more support and questions: www.brokking.net"));
      Serial.println(F(""));
      Serial.print(F("Waiting for another 5 seconds."));
    }
    if (loop_counter > 40 && loop_counter % 10 == 0)Serial.print(F("."));

      if (loop_counter == 90) {
      Serial.println(F(""));
      Serial.println(F(""));
      Serial.println(F("The ESC outputs are disabled for safety!!!"));
      warning = 1;
    }
  }
  if (warning == 0) {
    TIM4->CR1 = TIM_CR1_CEN | TIM_CR1_ARPE;
    TIM4->CR2 = 0;
    TIM4->SMCR = 0;
    TIM4->DIER = 0;
    TIM4->EGR = 0;
    TIM4->CCMR1 = (0b110 << 4) | TIM_CCMR1_OC1PE |(0b110 << 12) | TIM_CCMR1_OC2PE;
    TIM4->CCMR2 = (0b110 << 4) | TIM_CCMR2_OC3PE |(0b110 << 12) | TIM_CCMR2_OC4PE;
    TIM4->CCER = TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E;
    TIM4->PSC = 71;
    TIM4->ARR = 4000;
    TIM4->DCR = 0;
    TIM4->CCR1 = 1000;

    TIM4->CCR1 = channel_3;
    TIM4->CCR2 = channel_3;
    TIM4->CCR3 = channel_3;
    TIM4->CCR4 = channel_3;
    pinMode(PB6, PWM);
    pinMode(PB7, PWM);
    pinMode(PB8, PWM);
    pinMode(PB9, PWM);
  }
}

void handler_channel_1(void) {                    //This function is called when channel 1 is captured.
  if (0b1 &GPIOA->IDR  >> 0) {                     //If the receiver channel 1 input pulse on A0 is high.
    channel_1_start = TIM2->CCR1;                 //Record the start time of the pulse.
    TIM2->CCER |= TIM_CCER_CC1P;   //Change the input capture mode to the falling edge of the pulse.
  }
  else {                                                 //If the receiver channel 1 input pulse on A0 is low.
    channel_1 = TIM2->CCR1 - channel_1_start;     //Calculate the total pulse time.
    if (channel_1 < 0)channel_1 += 0xFFFF;               //If the timer has rolled over a correction is needed.
    TIM2->CCER &= ~TIM_CCER_CC1P;               //Change the input capture mode to the rising edge of the pulse.
  }
}

void handler_channel_2(void) {                           //This function is called when channel 2 is captured.
  if (0b1 &GPIOA->IDR >> 1) {                      //If the receiver channel 2 input pulse on A1 is high.
    channel_2_start = TIM2->CCR2;                 //Record the start time of the pulse.
    TIM2->CCER |= TIM_CCER_CC2P;                //Change the input capture mode to the falling edge of the pulse.
  }
  else {                                                 //If the receiver channel 2 input pulse on A1 is low.
    channel_2 = TIM2->CCR2 - channel_2_start;     //Calculate the total pulse time.
    if (channel_2 < 0)channel_2 += 0xFFFF;               //If the timer has rolled over a correction is needed.
    TIM2->CCER &= ~TIM_CCER_CC2P;               //Change the input capture mode to the rising edge of the pulse.
  }
}

void handler_channel_3(void) {                           //This function is called when channel 3 is captured.
  if (0b1 &GPIOA->IDR >> 2) {                      //If the receiver channel 3 input pulse on A2 is high.
    channel_3_start = TIM2->CCR3;                 //Record the start time of the pulse.
    TIM2->CCER |= TIM_CCER_CC3P;                //Change the input capture mode to the falling edge of the pulse.
  }
  else {                                                 //If the receiver channel 3 input pulse on A2 is low.
    channel_3 = TIM2->CCR3 - channel_3_start;     //Calculate the total pulse time.
    if (channel_3 < 0)channel_3 += 0xFFFF;               //If the timer has rolled over a correction is needed.
    TIM2->CCER &= ~TIM_CCER_CC3P;               //Change the input capture mode to the rising edge of the pulse.
  }
}

void handler_channel_4(void) {                           //This function is called when channel 4 is captured.
  if (0b1 &GPIOA->IDR >> 3) {                      //If the receiver channel 4 input pulse on A3 is high.
    channel_4_start = TIM2->CCR4;                 //Record the start time of the pulse.
    TIM2->CCER |= TIM_CCER_CC4P;                //Change the input capture mode to the falling edge of the pulse.
  }
  else {                                                 //If the receiver channel 4 input pulse on A3 is low.
    channel_4 = TIM2->CCR4 - channel_4_start;     //Calculate the total pulse time.
    if (channel_4 < 0)channel_4 += 0xFFFF;               //If the timer has rolled over a correction is needed.
    TIM2->CCER &= ~TIM_CCER_CC4P;               //Change the input capture mode to the rising edge of the pulse.
  }
}

void handler_channel_5(void) {                           //This function is called when channel 5 is captured.
  if (0b1 &GPIOA->IDR >> 6) {                      //If the receiver channel 5 input pulse on A6 is high.
    channel_5_start = TIM3->CCR1;                 //Record the start time of the pulse.
    TIM3->CCER |= TIM_CCER_CC1P;                //Change the input capture mode to the falling edge of the pulse.
  }
  else {                                                 //If the receiver channel 5 input pulse on A6 is low.
    channel_5 = TIM3->CCR1 - channel_5_start;     //Calculate the total pulse time.
    if (channel_5 < 0)channel_5 += 0xFFFF;               //If the timer has rolled over a correction is needed.
    TIM3->CCER &= ~TIM_CCER_CC1P;               //Change the input capture mode to the rising edge of the pulse.
  }
}

void handler_channel_6(void) {                           //This function is called when channel 6 is captured.
  if (0b1 &GPIOA->IDR >> 7) {                      //If the receiver channel 6 input pulse on A7 is high.
    channel_6_start = TIM3->CCR2;                 //Record the start time of the pulse.
    TIM3->CCER |= TIM_CCER_CC2P;                //Change the input capture mode to the falling edge of the pulse.
  }
  else {                                                 //If the receiver channel 6 input pulse on A7 is low.
    channel_6 = TIM3->CCR2 - channel_6_start;     //Calculate the total pulse time.
    if (channel_6 < 0)channel_6 += 0xFFFF;               //If the timer has rolled over a correction is needed.
    TIM3->CCER &= ~TIM_CCER_CC2P;               //Change the input capture mode to the rising edge of the pulse.
  }
}


[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
upload_protocol = stlink
debug_tool = stlink
monitor_speed = 115200
build_flags = -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC 

first bug; TIMFR2,attachCompare1Interrupt(handler_channel_1); have to be written in a different way but i was not able to discover How.

second bug pinMode(PB6, PWM); this istruction is used to putout TIM4 ch1 on PB6

Looks like there are typo’s in that line (“F” and “,”)!

TIMER2.attachCompare1Interrupt(handler_channel_1);

Ok for suggestion is a my mistake but problem is the following if you make it
er type ‘TIM_TypeDef*’ (maybe you meant to use ‘->’ ?)
31 | TIM2.attachCompare1Interrupt(handler_channel_1);
| ^~~~~~~~~~~~~~~~~~~~~~~
src\DRONE_TIMER_SETUP.cpp:32:8: error: request for member ‘attachCompare2Interrupt’ in ‘(TIM_TypeDef*)(1073741824 + 0)’, which is of pointer type ‘TIM_TypeDef*’ (maybe you meant to use ‘->’ ?)
32 | TIM2.attachCompare2Interrupt(handler_channel_2);
| ^~~~~~~~~~~~~~~~~~~~~~~
src\DRONE_TIMER_SETUP.cpp:33:3: error: ‘TIMER2’ was not declared in this scope; did you mean ‘TIM2’?
33 | TIMER2.attachCompare3Interrupt(handler_channel_3);
| ^~~~~~
| TIM2
src\DRONE_TIMER_SETUP.cpp:47:3: error: ‘TIMER3’ was not declared in this scope; did you mean ‘TIM3’?
47 | TIMER3.attachCompare1Interrupt(handler_channel_5);
| ^~~~~~
| TIM3
src\DRONE_TIMER_SETUP.cpp:105:18: error: ‘PWM’ was not declared in this scope; did you mean ‘PWR’?
105 | pinMode(PB6, PWM);
| ^~~
| PWR

As you can see the suggestion is  change "TIMER2" in "TIM2" but it is olso wrong and
"TIMER2" is not a pointer to use ->