diff --git a/libraries/AP_HAL/AP_HAL.h b/libraries/AP_HAL/AP_HAL.h index ff5324f27b..51ba7a746c 100644 --- a/libraries/AP_HAL/AP_HAL.h +++ b/libraries/AP_HAL/AP_HAL.h @@ -10,7 +10,6 @@ /* HAL Module Classes (all pure virtual) */ #include "UARTDriver.h" -#include "SPIDriver.h" #include "AnalogIn.h" #include "Storage.h" #include "GPIO.h" diff --git a/libraries/AP_HAL/AP_HAL_Namespace.h b/libraries/AP_HAL/AP_HAL_Namespace.h index 5277c6a438..ad6b004d6f 100644 --- a/libraries/AP_HAL/AP_HAL_Namespace.h +++ b/libraries/AP_HAL/AP_HAL_Namespace.h @@ -51,7 +51,6 @@ namespace AP_HAL { enum SPIDeviceType { // Devices using AP_HAL::SPIDevice abstraction SPIDevice_Type = -1, - SPIDevice_ADS7844 = 1, }; // Must be implemented by the concrete HALs. diff --git a/libraries/AP_HAL/HAL.h b/libraries/AP_HAL/HAL.h index d242907afe..52e516444a 100644 --- a/libraries/AP_HAL/HAL.h +++ b/libraries/AP_HAL/HAL.h @@ -6,7 +6,7 @@ #include "GPIO.h" #include "RCInput.h" #include "RCOutput.h" -#include "SPIDriver.h" +#include "SPIDevice.h" #include "Storage.h" #include "UARTDriver.h" #include "system.h" diff --git a/libraries/AP_HAL/SPIDevice.h b/libraries/AP_HAL/SPIDevice.h index a54582e48c..12fdd162d0 100644 --- a/libraries/AP_HAL/SPIDevice.h +++ b/libraries/AP_HAL/SPIDevice.h @@ -56,6 +56,12 @@ public: virtual int get_fd() override = 0; }; -/* SPIDeviceManager is temporarily provided by SPIDriver.h */ +class SPIDeviceManager { +public: + virtual OwnPtr get_device(const char *name) + { + return nullptr; + } +}; } diff --git a/libraries/AP_HAL/SPIDriver.h b/libraries/AP_HAL/SPIDriver.h deleted file mode 100644 index f9182ad896..0000000000 --- a/libraries/AP_HAL/SPIDriver.h +++ /dev/null @@ -1,69 +0,0 @@ -/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- -/* - * Copyright (C) 2015-2016 Intel Corporation. All rights reserved. - * - * This file is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#pragma once - -#include - -#include "AP_HAL_Namespace.h" -#include "SPIDevice.h" -#include "utility/OwnPtr.h" - -namespace AP_HAL { - -class SPIDeviceManager { -public: - virtual void init() = 0; - virtual SPIDeviceDriver* device(enum SPIDeviceType, uint8_t index = 0) = 0; - virtual OwnPtr get_device(const char *name) - { - return nullptr; - } -}; - -/** - * We still need an abstraction for performing bulk - * transfers to be portable to other platforms. - */ - -class SPIDeviceDriver { -public: - virtual void init() = 0; - virtual Semaphore* get_semaphore() = 0; - virtual bool transaction(const uint8_t *tx, uint8_t *rx, uint16_t len) = 0; - - virtual void cs_assert() = 0; - virtual void cs_release() = 0; - virtual uint8_t transfer (uint8_t data) = 0; - virtual void transfer (const uint8_t *data, uint16_t len) = 0; - - /** - optional set_bus_speed() interface. This can be used by drivers - to request higher speed for sensor registers once the sensor is - initialised. This is used by the MPU6000 driver which can - handle 20MHz for sensor register reads, but only 1MHz for other - registers. - */ - enum bus_speed { - SPI_SPEED_LOW, SPI_SPEED_HIGH - }; - - virtual void set_bus_speed(enum bus_speed speed) {} -}; - -}