mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
Rework SPI device interface
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#ifndef STA_SPI_DEVICE_HPP
|
||||
#define STA_SPI_DEVICE_HPP
|
||||
|
||||
#include <sta/intf/gpio_pin.hpp>
|
||||
#include <sta/intf/spi_interface.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
@@ -20,8 +21,9 @@ namespace sta
|
||||
public:
|
||||
/**
|
||||
* @param intf SPI hardware interface
|
||||
* @param pin Chip select pin
|
||||
*/
|
||||
SpiDevice(SpiInterface * intf);
|
||||
SpiDevice(SpiInterface * intf, GpioPin * csPin);
|
||||
|
||||
|
||||
/**
|
||||
@@ -94,14 +96,15 @@ namespace sta
|
||||
/**
|
||||
* @brief Activate device via CS pin.
|
||||
*/
|
||||
virtual void select() = 0;
|
||||
void select();
|
||||
/**
|
||||
* @brief Deactivate device via CS pin.
|
||||
*/
|
||||
virtual void deselect() = 0;
|
||||
void deselect();
|
||||
|
||||
private:
|
||||
SpiInterface * intf_; /**< SPI hardware interface */
|
||||
GpioPin * csPin_; /**< Chip select pin */
|
||||
};
|
||||
} // namespace sta
|
||||
|
Reference in New Issue
Block a user