ArduPilot HELP!!!

WHAT APM IS - ArduPilot (also ArduPilotMega - APM) is an open source unmanned aerial vehicle (UAV) platform, able to control autonomous multicopters, fixed-wing aircraft, traditional helicopters and ground rovers.

DATASHEET LINK-http://i.imgur.com/hZ5XlJS.png

I am in the process of building a quadcopter, everything went well, all the sensors worked, the engines and radio.
After a while I noticed that I do not find PID tuning, so I began to investigate, I saw that the minimum controller speed for reading the information from the sensors, radio, PID and send the engines, is 50 Hz, but my speed is 14 Hz.
After some tests, I saw that the main cause slowness is reading the information from the receiver.
When the controller did not try to read the information from the receiver I reached a speed of 200 Hz.
The function I used for reading the information from the receiver is PulseIn and is too slow.
After some more investigation I realized I needed to use INTERRUPTS PINS.
And the board has a special controller for that (according to the DATASHEET).

The solution to this is to use onboard controller ATMEGA32U2 that connected to INTERRUPT PINS. From what I gathered the controller would process the information from the receiver to the background and send it to the ATMEGA2560.

And even the most simple code does not work for me.

int pin = 27;//apm 2.6 indicator led
volatile int state = LOW;

void setup()
{
  pinMode(pin, OUTPUT);
  attachInterrupt(0, blink, CHANGE);
}

void loop()
{
  digitalWrite(pin, state);
}

void blink()
{
  state = !state;
}

there is another code that use a spaciel arduino IDE and the code work but i cant use arduino functions:

#include <AP_Common.h>
#include <AP_Math.h>
#include <AP_Param.h>
#include <AP_Progmem.h>
#include <AP_ADC.h>
//#include <AP_InertialSensor.h>

#include <AP_HAL.h>
#include <AP_HAL_AVR.h>

const AP_HAL::HAL& hal = AP_HAL_AVR_APM2;  // Hardware abstraction layer

void setup() 
{
}

void loop() 
{
  uint16_t channels[8];  // array for raw channel values

  // Read RC channels and store in channels array
  hal.rcin->read(channels, 8);
  
  // Copy from channels array to something human readable - array entry 0 = input 1, etc.
  uint16_t rcthr, rcyaw, rcpit, rcroll;   // Variables to store rc input
  rcthr = channels[2];  
  rcyaw = channels[3];
  rcpit = channels[1];
  rcroll = channels[0];

  hal.console->printf_P(
            PSTR("individual read THR %d YAW %d PIT %d ROLL %d\r\n"),
            rcthr, rcyaw, rcpit, rcroll);

  hal.scheduler->delay(50);  //Wait 50ms 
}

AP_HAL_MAIN();    // special macro that replace's one of Arduino's to setup the code (e.g. ensure loop() is called in a loop).

LINK TO apm RCInput(look for read()) library. i hope someone will be able to translate this to the arduino language - ardupilot-mega/RCInput_APM2.cpp at fc03139ccbaf1ce1cb64b6532dba69a9728d2eb9 · GaloisInc/ardupilot-mega · GitHub

How do I get the information from the ATMEGA32U-2? how it connects to the ATMEGA2560?