diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 16510e32cc..a14491bd24 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -172,7 +172,8 @@ APM_RC_APM1 APM_RC; // Dataflash //////////////////////////////////////////////////////////////////////////////// #if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2 -DataFlash_APM2 DataFlash; +AP_Semaphore spi3_semaphore; +DataFlash_APM2 DataFlash(&spi3_semaphore); #else DataFlash_APM1 DataFlash; #endif @@ -225,7 +226,11 @@ AP_Compass_HMC5843 compass; #endif #ifdef OPTFLOW_ENABLED -AP_OpticalFlow_ADNS3080 optflow(OPTFLOW_CS_PIN); + #if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2 +AP_OpticalFlow_ADNS3080 optflow(&spi3_semaphore,OPTFLOW_CS_PIN); + #else +AP_OpticalFlow_ADNS3080 optflow(NULL,OPTFLOW_CS_PIN); + #endif #else AP_OpticalFlow optflow; #endif