2012-12-14 21:55:38 -04:00
|
|
|
|
|
|
|
#ifndef __AP_HAL_EMPTY_SPIDRIVER_H__
|
|
|
|
#define __AP_HAL_EMPTY_SPIDRIVER_H__
|
|
|
|
|
2015-08-11 03:28:43 -03:00
|
|
|
#include "AP_HAL_Empty.h"
|
2013-01-02 03:22:07 -04:00
|
|
|
#include "Semaphores.h"
|
2012-12-14 21:55:38 -04:00
|
|
|
|
|
|
|
class Empty::EmptySPIDeviceDriver : public AP_HAL::SPIDeviceDriver {
|
|
|
|
public:
|
|
|
|
EmptySPIDeviceDriver();
|
|
|
|
void init();
|
|
|
|
AP_HAL::Semaphore* get_semaphore();
|
2015-08-19 12:42:30 -03:00
|
|
|
bool transaction(const uint8_t *tx, uint8_t *rx, uint16_t len);
|
2012-12-17 21:12:15 -04:00
|
|
|
|
2012-12-14 21:55:38 -04:00
|
|
|
void cs_assert();
|
|
|
|
void cs_release();
|
|
|
|
uint8_t transfer (uint8_t data);
|
2013-01-12 07:13:23 -04:00
|
|
|
void transfer (const uint8_t *data, uint16_t len);
|
2012-12-17 15:07:26 -04:00
|
|
|
private:
|
|
|
|
EmptySemaphore _semaphore;
|
2012-12-14 21:55:38 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class Empty::EmptySPIDeviceManager : public AP_HAL::SPIDeviceManager {
|
|
|
|
public:
|
|
|
|
EmptySPIDeviceManager();
|
|
|
|
void init(void *);
|
2015-09-14 15:47:07 -03:00
|
|
|
AP_HAL::SPIDeviceDriver* device(enum AP_HAL::SPIDevice, uint8_t index);
|
2012-12-14 21:55:38 -04:00
|
|
|
private:
|
|
|
|
EmptySPIDeviceDriver _device;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AP_HAL_EMPTY_SPIDRIVER_H__
|