2012-08-20 15:37:46 -03:00
|
|
|
|
|
|
|
#ifndef __AP_HAL_SPI_DRIVER_H__
|
|
|
|
#define __AP_HAL_SPI_DRIVER_H__
|
|
|
|
|
|
|
|
#include "AP_HAL_Namespace.h"
|
|
|
|
|
2012-11-28 21:57:20 -04:00
|
|
|
|
|
|
|
class AP_HAL::SPIDeviceManager {
|
|
|
|
public:
|
|
|
|
virtual void init(void *) = 0;
|
2012-12-14 21:55:20 -04:00
|
|
|
virtual AP_HAL::SPIDeviceDriver* device(enum AP_HAL::SPIDevice) = 0;
|
2012-11-28 21:57:20 -04:00
|
|
|
};
|
|
|
|
|
2012-08-30 20:25:35 -03:00
|
|
|
/**
|
2012-11-28 21:57:20 -04:00
|
|
|
* We still need an abstraction for performing bulk
|
2012-08-30 20:25:35 -03:00
|
|
|
* transfers to be portable to other platforms.
|
|
|
|
*/
|
|
|
|
|
2012-11-28 21:57:20 -04:00
|
|
|
class AP_HAL::SPIDeviceDriver {
|
2012-08-20 15:37:46 -03:00
|
|
|
public:
|
2012-11-28 21:57:20 -04:00
|
|
|
virtual void init() = 0;
|
|
|
|
virtual AP_HAL::Semaphore* get_semaphore() = 0;
|
2012-12-17 21:06:51 -04:00
|
|
|
virtual void transaction(const uint8_t *tx, uint8_t *rx, uint16_t len) = 0;
|
|
|
|
|
2012-11-28 21:57:20 -04:00
|
|
|
virtual void cs_assert() = 0;
|
|
|
|
virtual void cs_release() = 0;
|
2012-08-30 20:25:35 -03:00
|
|
|
virtual uint8_t transfer (uint8_t data) = 0;
|
2013-01-12 07:10:00 -04:00
|
|
|
virtual void transfer (const uint8_t *data, uint16_t len) = 0;
|
2012-08-20 15:37:46 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AP_HAL_SPI_DRIVER_H__
|
|
|
|
|