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 
72 
74  bool open(NATIVE_INT_TYPE device,
75  NATIVE_INT_TYPE select,
76  SpiFrequency clock,
78 
79  PRIVATE:
80 
81  // ----------------------------------------------------------------------
82  // Handler implementations for user-defined typed input ports
83  // ----------------------------------------------------------------------
84 
87  void SpiReadWrite_handler(const NATIVE_INT_TYPE portNum,
88  Fw::Buffer &WriteBuffer, Fw::Buffer &readBuffer);
89 
90  NATIVE_INT_TYPE m_fd;
91  NATIVE_INT_TYPE m_device;
92  NATIVE_INT_TYPE m_select;
93  U32 m_bytes;
94 
95  };
96 
97 } // end namespace Drv
98 
99 #endif
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
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.
@ 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)