mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 17:47:10 -06:00
Instead of adding the name argument to a constructor when FW_OBJECT_NAMES is enabled, always supply a name argument. Add a marco that conditionally sets the name to "" if FW_OBJECT_NAMES is not set. This cleans up a lot of the conditional compilation switches that weren't being tested and would silently break, while still stripping the strings from the binary.
104 lines
2.7 KiB
C++
104 lines
2.7 KiB
C++
// ======================================================================
|
|
// \title LinuxGpioDriverImpl.hpp
|
|
// \author tcanham
|
|
// \brief hpp file for LinuxGpioDriver component implementation class
|
|
//
|
|
// \copyright
|
|
// Copyright 2009-2015, by the California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
//
|
|
// ======================================================================
|
|
|
|
#ifndef LinuxGpioDriver_HPP
|
|
#define LinuxGpioDriver_HPP
|
|
|
|
#include "Drv/LinuxGpioDriver/LinuxGpioDriverComponentAc.hpp"
|
|
#include <Os/Task.hpp>
|
|
|
|
namespace Drv {
|
|
|
|
class LinuxGpioDriverComponentImpl :
|
|
public LinuxGpioDriverComponentBase
|
|
{
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Construction, initialization, and destruction
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Construct object LinuxGpioDriver
|
|
//!
|
|
LinuxGpioDriverComponentImpl(
|
|
const char *const compName /*!< The component name*/
|
|
);
|
|
|
|
//! Initialize object LinuxGpioDriver
|
|
//!
|
|
void init(
|
|
const NATIVE_INT_TYPE instance = 0 /*!< The instance number*/
|
|
);
|
|
|
|
//! Destroy object LinuxGpioDriver
|
|
//!
|
|
~LinuxGpioDriverComponentImpl(void);
|
|
|
|
//! Start interrupt task
|
|
Os::Task::TaskStatus startIntTask(NATIVE_INT_TYPE priority, NATIVE_INT_TYPE cpuAffinity = -1);
|
|
|
|
//! configure GPIO
|
|
enum GpioDirection {
|
|
GPIO_IN, //!< input
|
|
GPIO_OUT, //!< output
|
|
GPIO_INT //!< interrupt
|
|
};
|
|
|
|
//! open GPIO
|
|
bool open(NATIVE_INT_TYPE gpio, GpioDirection direction);
|
|
|
|
//! exit thread
|
|
void exitThread(void);
|
|
|
|
PRIVATE:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Handler implementations for user-defined typed input ports
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Handler implementation for gpioRead
|
|
//!
|
|
void gpioRead_handler(
|
|
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
|
bool &state
|
|
);
|
|
|
|
//! Handler implementation for gpioWrite
|
|
//!
|
|
void gpioWrite_handler(
|
|
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
|
bool state
|
|
);
|
|
|
|
//! keep GPIO ID
|
|
NATIVE_INT_TYPE m_gpio;
|
|
|
|
//! device direction
|
|
GpioDirection m_direction;
|
|
|
|
//! Entry point for task waiting for interrupt
|
|
static void intTaskEntry(void * ptr);
|
|
|
|
//! Task object for RTI task
|
|
Os::Task m_intTask;
|
|
//! file descriptor for GPIO
|
|
NATIVE_INT_TYPE m_fd;
|
|
//! flag to quit thread
|
|
bool m_quitThread;
|
|
|
|
};
|
|
|
|
} // end namespace Drv
|
|
|
|
#endif
|