mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-09-28 21:17:33 +00:00
Rework SPI device interface
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
#include <sta/intf/spi_device.hpp>
|
||||
#include <sta/spi_device.hpp>
|
||||
|
||||
#include <sta/assert.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
SpiDevice::SpiDevice(SpiInterface * intf)
|
||||
: intf_{intf}
|
||||
SpiDevice::SpiDevice(SpiInterface * intf, GpioPin * csPin)
|
||||
: intf_{intf}, csPin_{csPin}
|
||||
{
|
||||
STA_ASSERT(intf != nullptr);
|
||||
STA_ASSERT(csPin != nullptr);
|
||||
}
|
||||
|
||||
void SpiDevice::beginTransmission()
|
||||
@@ -73,4 +74,15 @@ namespace sta
|
||||
{
|
||||
return intf_->settings();
|
||||
}
|
||||
|
||||
|
||||
void SpiDevice::select()
|
||||
{
|
||||
csPin_->setState(GpioPinState::LOW);
|
||||
}
|
||||
|
||||
void SpiDevice::deselect()
|
||||
{
|
||||
csPin_->setState(GpioPinState::HIGH);
|
||||
}
|
||||
} // namespace sta
|
Reference in New Issue
Block a user