F´ Flight Software - C/C++ Documentation
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
SPI_FREQUENCY_1MHZ
= 1000000UL,
29
SPI_FREQUENCY_5MHZ
= 5000000UL,
30
SPI_FREQUENCY_10MHZ
= 10000000UL,
31
SPI_FREQUENCY_15MHZ
= 15000000UL,
32
SPI_FREQUENCY_20MHZ
= 20000000UL,
33
};
34
46
enum
SpiMode
{
47
SPI_MODE_CPOL_LOW_CPHA_LOW
,
48
SPI_MODE_CPOL_LOW_CPHA_HIGH
,
49
SPI_MODE_CPOL_HIGH_CPHA_LOW
,
50
SPI_MODE_CPOL_HIGH_CPHA_HIGH
,
51
};
52
53
class
LinuxSpiDriverComponentImpl
final :
public
LinuxSpiDriverComponentBase
{
54
public
:
55
// ----------------------------------------------------------------------
56
// Construction, initialization, and destruction
57
// ----------------------------------------------------------------------
58
61
LinuxSpiDriverComponentImpl
(
const
char
*
const
compName
62
);
63
66
~LinuxSpiDriverComponentImpl
();
67
69
bool
open
(
FwIndexType
device,
70
FwIndexType
select,
71
SpiFrequency
clock,
72
SpiMode
spiMode =
SpiMode::SPI_MODE_CPOL_LOW_CPHA_LOW
);
73
74
private
:
75
// ----------------------------------------------------------------------
76
// Handler implementations for user-defined typed input ports
77
// ----------------------------------------------------------------------
78
81
SpiStatus
SpiWriteRead_handler(
const
FwIndexType
portNum,
82
Fw::Buffer
& WriteBuffer,
83
Fw::Buffer
& readBuffer);
84
85
// @ DEPRECATED: Use SpiWriteRead port instead (same operation with a return value)
88
void
SpiReadWrite_handler(
const
FwIndexType
portNum,
89
Fw::Buffer
& WriteBuffer,
90
Fw::Buffer
& readBuffer);
91
92
int
m_fd;
93
FwIndexType
m_device;
94
FwIndexType
m_select;
95
FwSizeType
m_bytes;
96
};
97
98
}
// end namespace Drv
99
100
#endif
Drv::LinuxSpiDriverComponentImpl
Definition:
LinuxSpiDriverComponentImpl.hpp:53
Drv::LinuxSpiDriverComponentImpl::open
bool open(FwIndexType device, FwIndexType select, SpiFrequency clock, SpiMode spiMode=SpiMode::SPI_MODE_CPOL_LOW_CPHA_LOW)
Open device.
Definition:
LinuxSpiDriverComponentImpl.cpp:89
FwSizeType
PlatformSizeType FwSizeType
Definition:
FwSizeTypeAliasAc.h:15
Drv::SPI_MODE_CPOL_HIGH_CPHA_HIGH
(CPOL = 1, CPHA = 1)
Definition:
LinuxSpiDriverComponentImpl.hpp:50
Drv::LinuxSpiDriverComponentImpl::LinuxSpiDriverComponentImpl
LinuxSpiDriverComponentImpl(const char *const compName)
Definition:
LinuxSpiDriverComponentImplCommon.cpp:22
Drv::SPI_FREQUENCY_10MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:30
Drv::LinuxSpiDriverComponentBase
Auto-generated base for LinuxSpiDriver component.
Definition:
LinuxSpiDriverComponentAc.hpp:33
Drv::SPI_MODE_CPOL_HIGH_CPHA_LOW
(CPOL = 1, CPHA = 0)
Definition:
LinuxSpiDriverComponentImpl.hpp:49
Drv::SPI_FREQUENCY_20MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:32
Drv::SPI_MODE_CPOL_LOW_CPHA_LOW
(CPOL = 0, CPHA = 0)
Definition:
LinuxSpiDriverComponentImpl.hpp:47
Drv::SpiMode
SpiMode
Definition:
LinuxSpiDriverComponentImpl.hpp:46
Drv::LinuxSpiDriverComponentImpl::~LinuxSpiDriverComponentImpl
~LinuxSpiDriverComponentImpl()
Definition:
LinuxSpiDriverComponentImpl.cpp:198
Drv::SPI_FREQUENCY_5MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:29
Drv::SpiStatus
Definition:
SpiStatusEnumAc.hpp:16
Drv::SPI_MODE_CPOL_LOW_CPHA_HIGH
(CPOL = 0, CPHA = 1)
Definition:
LinuxSpiDriverComponentImpl.hpp:48
Drv::SPI_FREQUENCY_1MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:28
FwIndexType
PlatformIndexType FwIndexType
Definition:
FwIndexTypeAliasAc.h:15
Drv
Definition:
AsyncByteStreamBufferAdapterComponentAc.cpp:14
Drv::SPI_FREQUENCY_15MHZ
Definition:
LinuxSpiDriverComponentImpl.hpp:31
LinuxSpiDriverComponentAc.hpp
Fw::Buffer
Definition:
Buffer.hpp:47
Drv::SpiFrequency
SpiFrequency
Definition:
LinuxSpiDriverComponentImpl.hpp:27
Drv
LinuxSpiDriver
LinuxSpiDriverComponentImpl.hpp
Generated by
1.8.14