diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 48c149fb77..bdb646c6b6 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -171,11 +171,12 @@ APM_RC_APM1 APM_RC; //////////////////////////////////////////////////////////////////////////////// // Dataflash //////////////////////////////////////////////////////////////////////////////// -#if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2 +AP_Semaphore spi_semaphore; AP_Semaphore spi3_semaphore; +#if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2 DataFlash_APM2 DataFlash(&spi3_semaphore); #else -DataFlash_APM1 DataFlash; +DataFlash_APM1 DataFlash(&spi_semaphore); #endif @@ -227,9 +228,9 @@ AP_Compass_HMC5843 compass; #ifdef OPTFLOW_ENABLED #if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2 -AP_OpticalFlow_ADNS3080 optflow(&spi3_semaphore,OPTFLOW_CS_PIN); +AP_OpticalFlow_ADNS3080 optflow(OPTFLOW_CS_PIN); #else -AP_OpticalFlow_ADNS3080 optflow(NULL,OPTFLOW_CS_PIN); +AP_OpticalFlow_ADNS3080 optflow(OPTFLOW_CS_PIN); #endif #else AP_OpticalFlow optflow; diff --git a/ArduCopter/sensors.pde b/ArduCopter/sensors.pde index e708d0f4a8..64cdbd2ed0 100644 --- a/ArduCopter/sensors.pde +++ b/ArduCopter/sensors.pde @@ -51,7 +51,7 @@ static void init_compass() static void init_optflow() { #ifdef OPTFLOW_ENABLED - if( optflow.init(false, &timer_scheduler) == false ) { + if( optflow.init(false, &timer_scheduler, &spi_semaphore, &spi3_semaphore) == false ) { g.optflow_enabled = false; SendDebug("\nFailed to Init OptFlow "); }