Browse Source

AP_HAL_Linux: allow to change spi device state

Allowing to change the SPI device state allows us to save the
information whether the device was already initialized and avoid 2
separate drivers to initialize it.
master
Lucas De Marchi 10 years ago committed by Andrew Tridgell
parent
commit
fde43a77b3
  1. 3
      libraries/AP_HAL_Linux/SPIDriver.h

3
libraries/AP_HAL_Linux/SPIDriver.h

@ -28,6 +28,8 @@ public:
uint8_t transfer (uint8_t data); uint8_t transfer (uint8_t data);
void transfer (const uint8_t *data, uint16_t len); void transfer (const uint8_t *data, uint16_t len);
void set_bus_speed(enum bus_speed speed); void set_bus_speed(enum bus_speed speed);
void set_state(State state) override { _state = state; }
State get_state() override { return _state; }
private: private:
uint16_t _bus; uint16_t _bus;
@ -36,6 +38,7 @@ private:
AP_HAL::DigitalSource *_cs; AP_HAL::DigitalSource *_cs;
uint8_t _mode; uint8_t _mode;
uint8_t _bitsPerWord; uint8_t _bitsPerWord;
State _state = State::UNKNOWN;
uint32_t _lowspeed; uint32_t _lowspeed;
uint32_t _highspeed; uint32_t _highspeed;
uint32_t _speed; uint32_t _speed;

Loading…
Cancel
Save