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
16
#include "
Drv/LinuxSpiDriver/LinuxSpiDriverComponentAc.hpp
"
17
18
namespace
Drv
{
19
27
enum
SpiFrequency
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
{
49
SPI_MODE_CPOL_LOW_CPHA_LOW
,
50
SPI_MODE_CPOL_LOW_CPHA_HIGH
,
51
SPI_MODE_CPOL_HIGH_CPHA_LOW
,
52
SPI_MODE_CPOL_HIGH_CPHA_HIGH
,
53
};
54
55
class
LinuxSpiDriverComponentImpl
:
public
LinuxSpiDriverComponentBase
{
56
57
public
:
58
59
// ----------------------------------------------------------------------
60
// Construction, initialization, and destruction
61
// ----------------------------------------------------------------------
62
65
LinuxSpiDriverComponentImpl
(
66
const
char
*
const
compName
67
);
68
71
~LinuxSpiDriverComponentImpl
();
72
74
bool
open
(
NATIVE_INT_TYPE
device,
75
NATIVE_INT_TYPE
select,
76
SpiFrequency
clock,
77
SpiMode
spiMode =
SpiMode::SPI_MODE_CPOL_LOW_CPHA_LOW
);
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
NATIVE_INT_TYPE
PlatformIntType NATIVE_INT_TYPE
Definition:
BasicTypes.h:55
LinuxSpiDriverComponentAc.hpp
Drv::LinuxSpiDriverComponentBase
Auto-generated base for LinuxSpiDriver component.
Definition:
LinuxSpiDriverComponentAc.hpp:30
Drv::LinuxSpiDriverComponentImpl
Definition:
LinuxSpiDriverComponentImpl.hpp:55
Drv::LinuxSpiDriverComponentImpl::~LinuxSpiDriverComponentImpl
~LinuxSpiDriverComponentImpl()
Definition:
LinuxSpiDriverComponentImpl.cpp:189
Drv::LinuxSpiDriverComponentImpl::LinuxSpiDriverComponentImpl
LinuxSpiDriverComponentImpl(const char *const compName)
Definition:
LinuxSpiDriverComponentImplCommon.cpp:23
Drv::LinuxSpiDriverComponentImpl::open
bool open(NATIVE_INT_TYPE device, NATIVE_INT_TYPE select, SpiFrequency clock, SpiMode spiMode=SpiMode::SPI_MODE_CPOL_LOW_CPHA_LOW)
Open device.
Definition:
LinuxSpiDriverComponentImpl.cpp:71
Fw::Buffer
Definition:
Buffer.hpp:43
Drv
Definition:
BlockDriverComponentAc.cpp:14
Drv::SpiFrequency
SpiFrequency
Definition:
LinuxSpiDriverComponentImpl.hpp:28
Drv::SPI_FREQUENCY_1MHZ
@ SPI_FREQUENCY_1MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:29
Drv::SPI_FREQUENCY_15MHZ
@ SPI_FREQUENCY_15MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:32
Drv::SPI_FREQUENCY_20MHZ
@ SPI_FREQUENCY_20MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:33
Drv::SPI_FREQUENCY_5MHZ
@ SPI_FREQUENCY_5MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:30
Drv::SPI_FREQUENCY_10MHZ
@ SPI_FREQUENCY_10MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:31
Drv::SpiMode
SpiMode
Definition:
LinuxSpiDriverComponentImpl.hpp:48
Drv::SPI_MODE_CPOL_HIGH_CPHA_LOW
@ SPI_MODE_CPOL_HIGH_CPHA_LOW
(CPOL = 1, CPHA = 0)
Definition:
LinuxSpiDriverComponentImpl.hpp:51
Drv::SPI_MODE_CPOL_LOW_CPHA_HIGH
@ SPI_MODE_CPOL_LOW_CPHA_HIGH
(CPOL = 0, CPHA = 1)
Definition:
LinuxSpiDriverComponentImpl.hpp:50
Drv::SPI_MODE_CPOL_HIGH_CPHA_HIGH
@ SPI_MODE_CPOL_HIGH_CPHA_HIGH
(CPOL = 1, CPHA = 1)
Definition:
LinuxSpiDriverComponentImpl.hpp:52
Drv::SPI_MODE_CPOL_LOW_CPHA_LOW
@ SPI_MODE_CPOL_LOW_CPHA_LOW
(CPOL = 0, CPHA = 0)
Definition:
LinuxSpiDriverComponentImpl.hpp:49
Drv
LinuxSpiDriver
LinuxSpiDriverComponentImpl.hpp
Generated by
1.9.1