15 namespace duds {
namespace hardware {
namespace interface {
90 return std::unique_ptr<MasterSyncSerialAccess>(
mssacc =
106 acc.
mss = shared_from_this();
111 std::unique_ptr<MasterSyncSerialAccess> acc =
access();
152 const std::uint8_t *buff,
164 Conversation::PartVector::iterator iter = conv.
begin();
165 for (; iter != conv.
end(); ++iter) {
unsigned int clockFrequency() const noexcept
Computes and returns the maximum clock frequency in Hertz.
static constexpr Flags MpfBreak
True/set to indicate that any kind of selection signal should be toggled, or a stop condition should ...
MasterSyncSerial()
Builds a MasterSyncSerial with an invalid clock period and all configuration flags clear...
static constexpr Flags MssSpiMode2LSb
Flags for SPI mode 2 with the LSb transfered first.
virtual void open()=0
Transitions the object from the ready (MssReady) to the open (MssOpen) state.
virtual void close()=0
Transitions the object from the open (MssOpen) to the ready (MssReady) state.
void condStop()
Calls stop() if currently communicating (set MssCommunicating flag).
static constexpr Flags MssSpiMode2
Flags for SPI mode 2.
The requested operation requires communication to be in the ready state.
static constexpr Flags MssMSbFirst
Send data MSb first, little endian.
static constexpr Flags MssFullDuplex
Communication is full duplex.
static constexpr Flags MssCommunicating
Indicates that communication is underway.
static constexpr Flags MssSpiMode1
Flags for SPI mode 1.
std::unique_ptr< MasterSyncSerialAccess > access()
Obtain access for communication; transitions the object from the ready (MssReady) to the open (MssOpe...
static constexpr Flags MssSpiMode1LSb
Flags for SPI mode 1 with the LSb transfered first.
duds::general::BitFlags< struct MssFlags > Flags
Configuration flags for various synchronous serial options.
unsigned int clockPeriod() const noexcept
Returns the minimum clock period in nanoseconds.
virtual void transmit(const std::uint8_t *buff, duds::general::Bits bits)
Sends bits of data.
BitFlags clear()
Clear all bits.
static constexpr Flags MssConfigMask
All the flags that are used for configuration rather than the current state.
void converseAlreadyOpen(Conversation &conv)
Has a half-duplex Conversation with the connected device.
static constexpr Flags MssSpiMode3
Flags for SPI mode 3.
virtual void converse(Conversation &conv)
Has a half-duplex Conversation with the connected device.
static constexpr Flags MssUseSelect
Use a select line to tell a device to pay attention to the master.
Represents a section of a half-duplex conversation with a device.
unsigned int minHalfPeriod
The minimum time between changing the clock edge in nanoseconds.
virtual ~MasterSyncSerial()=0
Derived class destructors should assure that communication has stopped by calling forceClose()...
static constexpr Flags MssSpiMode0
Flags for SPI mode 0.
std::unique_ptr< MasterSyncSerialAccess > accessStart()
Obtain access for communication; transitions the object from the ready (MssReady) to the communicatin...
static constexpr Flags MssOpen
Indicates that all required resources for communication have been acquired.
static constexpr Flags MssSpiMode0LSb
Flags for SPI mode 0 with the LSb transfered first.
virtual void stop()=0
Denotes the end of a conversation; transitions from the communicating state to the open state...
static std::wstring_convert< std::codecvt_utf8< char32_t >, char32_t > conv
String converter; UTF-8 to/from UTF-32.
static constexpr Flags MssSpiMode3LSb
Flags for SPI mode 3 with the LSb transfered first.
Flags flags() const
Returns the flags.
virtual std::size_t length() const =0
Returns the length of the buffer following the start pointer.
virtual char * start() const =0
Returns a pointer to the begining of the conversation part's buffer.
Provides access for communicating using a MasterSyncSerial object.
std::shared_ptr< MasterSyncSerial > mss
The serial interface used by this access object.
Header for Conversarion; includes ConversationVector.hpp and ConversationExternal.hpp.
PartVector::iterator begin()
An iterator to the first ConversationPart that allows modification.
static constexpr Flags MssReady
Indictates that all required resources for communication have been identified and passed a validity c...
static constexpr Flags MssOutFallInRise
Output on the falling edge of the clock and read on the rising edge.
A class to assist with specifiying the sizes of data with scaling units, much like std::chrono::durat...
void forceClose()
Attempts to forcibly cease communications by calling condStop() and close().
virtual void start()=0
Denotes the start of a conversation; transitions from the open state to the communicating state...
The requested operation requires communication to not already be in use.
The requested operation requires communication to be in the open state.
MasterSyncSerialAccess * mssacc
A pointer to the current access object or nullptr.
PartVector::iterator end()
An iterator to the end of ConversationPart vector.
virtual void transfer(const std::uint8_t *__restrict__ out, std::uint8_t *__restrict__ in, duds::general::Bits bits)=0
Sends and/or receives bits of data.
static constexpr Flags MssClockIdleHigh
Before communication begins, and after it ends, the clock line should have a high logic level...
virtual void receive(std::uint8_t *buff, duds::general::Bits bits)
Receives bits of data.
static constexpr Flags MssFirstDerivedClassFlag
The first flag that may be defined by a derived class.
void condStart()
Calls start() if not currently communicating (clear MssCommunicating flag).
void retire(MasterSyncSerialAccess *acc)
Removes the access object from use.
Flags flags
Configuration flags.
bool input() const
True if this part is flagged for input use.
#define DUDS_THROW_EXCEPTION(x)
Works like BOOST_THROW_EXCEPTION, but includes a stack trace if DUDS_ERRORS_VERBOSE is defined...
friend class MasterSyncSerialAccess
The access object calls select(), deselect(), and retire(MasterSyncSerialAccess *).
The given MasterSyncSerialAccess object already provides access to a MasterSyncSerial object...
An attempt was made to retire a MasterSyncSerialAccess object that does not belong to the serial inte...
Represents a two-way conversation with a device.