F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
LinuxSpiDriverComponentImpl.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title LinuxSpiDriverImpl.hpp
3 // \author tcanham
4 // \brief hpp file for LinuxSpiDriver component implementation class
5 //
6 // \copyright
7 // Copyright 2009-2015, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef LinuxSpiDriver_HPP
14 #define LinuxSpiDriver_HPP
15 
17 
18 namespace Drv {
19 
28  {
29  SPI_FREQUENCY_1MHZ = 1000000UL,
30  SPI_FREQUENCY_5MHZ = 5000000UL,
31  SPI_FREQUENCY_10MHZ = 10000000UL,
32  SPI_FREQUENCY_15MHZ = 15000000UL,
33  SPI_FREQUENCY_20MHZ = 20000000UL,
34  };
35 
47  enum SpiMode
48  {
53  };
54 
56 
57  public:
58 
59  // ----------------------------------------------------------------------
60  // Construction, initialization, and destruction
61  // ----------------------------------------------------------------------
62 
66  const char * const compName
67  );
68 
71  void init(const NATIVE_INT_TYPE instance = 0
72  );
73 
77 
79  bool open(NATIVE_INT_TYPE device,
80  NATIVE_INT_TYPE select,
81  SpiFrequency clock,
83 
84  PRIVATE:
85 
86  // ----------------------------------------------------------------------
87  // Handler implementations for user-defined typed input ports
88  // ----------------------------------------------------------------------
89 
92  void SpiReadWrite_handler(const NATIVE_INT_TYPE portNum,
93  Fw::Buffer &WriteBuffer, Fw::Buffer &readBuffer);
94 
95  NATIVE_INT_TYPE m_fd;
96  NATIVE_INT_TYPE m_device;
97  NATIVE_INT_TYPE m_select;
98  U32 m_bytes;
99 
100  };
101 
102 } // end namespace Drv
103 
104 #endif
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
Auto-generated base for LinuxSpiDriver component.
bool open(NATIVE_INT_TYPE device, NATIVE_INT_TYPE select, SpiFrequency clock, SpiMode spiMode=SpiMode::SPI_MODE_CPOL_LOW_CPHA_LOW)
Open device.
void init()
Object initializer.
Definition: ObjBase.cpp:27
@ SPI_MODE_CPOL_HIGH_CPHA_LOW
(CPOL = 1, CPHA = 0)
@ SPI_MODE_CPOL_LOW_CPHA_HIGH
(CPOL = 0, CPHA = 1)
@ SPI_MODE_CPOL_HIGH_CPHA_HIGH
(CPOL = 1, CPHA = 1)
@ SPI_MODE_CPOL_LOW_CPHA_LOW
(CPOL = 0, CPHA = 0)