2012-12-14 21:55:38 -04:00
|
|
|
|
|
|
|
#ifndef __AP_HAL_EMPTY_SPIDRIVER_H__
|
|
|
|
#define __AP_HAL_EMPTY_SPIDRIVER_H__
|
|
|
|
|
|
|
|
#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();
|
2012-12-17 21:12:15 -04:00
|
|
|
void transaction(const uint8_t *tx, uint8_t *rx, uint16_t len);
|
|
|
|
|
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 *);
|
|
|
|
AP_HAL::SPIDeviceDriver* device(enum AP_HAL::SPIDevice);
|
|
|
|
private:
|
|
|
|
EmptySPIDeviceDriver _device;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AP_HAL_EMPTY_SPIDRIVER_H__
|