mrfioc2  2.3.0
Classes | Public Member Functions | Protected Attributes | List of all members
mrf::SPIInterface Struct Referenceabstract

Interface for SPI Master. More...

#include <spi.h>

Inheritance diagram for mrf::SPIInterface:
Inheritance graph
[legend]

Classes

struct  Operation
 

Public Member Functions

 SPIInterface ()
 
virtual ~SPIInterface ()
 
virtual void select (unsigned id)=0
 Select numbered device. 0 clears selection. More...
 
virtual epicsUInt8 cycle (epicsUInt8 in)=0
 
virtual void cycles (size_t nops, const Operation *ops)
 
double timeout () const
 timeout in seconds for an individual cycle() More...
 
void setTimeout (double t)
 

Protected Attributes

epicsMutex mutex
 

Detailed Description

Interface for SPI Master.

Definition at line 20 of file spi.h.

Constructor & Destructor Documentation

◆ SPIInterface()

mrf::SPIInterface::SPIInterface ( )

Definition at line 14 of file spi.cpp.

15  :optimo(3.0)
16 {}

◆ ~SPIInterface()

mrf::SPIInterface::~SPIInterface ( )
virtual

Definition at line 18 of file spi.cpp.

18 {}

Member Function Documentation

◆ cycle()

virtual epicsUInt8 mrf::SPIInterface::cycle ( epicsUInt8  in)
pure virtual

Perform a single SPI transaction

Exceptions
std::runtime_erroron timeout

Implemented in MRMSPI.

◆ cycles()

void mrf::SPIInterface::cycles ( size_t  nops,
const Operation ops 
)
virtual

Definition at line 25 of file spi.cpp.

27 {
28  for(size_t n=0; n<nops; n++)
29  {
30  const Operation& op = ops[n];
31 
32  for(size_t i=0; i<op.ncycles; i++) {
33  epicsUInt8 O = this->cycle(op.in ? op.in[i] : 0);
34  if(op.out)
35  op.out[i] = O;
36  }
37  }
38 }
virtual epicsUInt8 cycle(epicsUInt8 in)=0

◆ select()

void mrf::SPIInterface::select ( unsigned  id)
pure virtual

Select numbered device. 0 clears selection.

Implemented in MRMSPI.

Definition at line 21 of file spi.cpp.

22 {}

◆ setTimeout()

void mrf::SPIInterface::setTimeout ( double  t)

Definition at line 48 of file spi.cpp.

49 {
50  SCOPED_LOCK(mutex);
51  optimo = t;
52 }
epicsMutex mutex
Definition: spi.h:46

◆ timeout()

double mrf::SPIInterface::timeout ( ) const

timeout in seconds for an individual cycle()

Definition at line 41 of file spi.cpp.

42 {
43  SCOPED_LOCK(mutex);
44  return optimo;
45 }
epicsMutex mutex
Definition: spi.h:46

Member Data Documentation

◆ mutex

epicsMutex mrf::SPIInterface::mutex
mutableprotected

Definition at line 46 of file spi.h.


The documentation for this struct was generated from the following files: