44 lines
978 B
C++
44 lines
978 B
C++
#ifndef C88B7A31_D4F3_4E43_B4CE_45003C99E915
|
|
#define C88B7A31_D4F3_4E43_B4CE_45003C99E915
|
|
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
#include <string>
|
|
|
|
namespace Hardware
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DECLARE
|
|
*******************************************************************************
|
|
*/
|
|
class GPIO
|
|
{
|
|
public:
|
|
enum class Direction
|
|
{
|
|
IN,
|
|
OUT,
|
|
};
|
|
|
|
public:
|
|
GPIO(int pinno);
|
|
~GPIO();
|
|
|
|
public:
|
|
void direction(Direction dir);
|
|
void write(unsigned level);
|
|
unsigned read();
|
|
|
|
private:
|
|
void writeFile(const std::string& path, const void* pData, int len);
|
|
void writeDirection(const std::string& value);
|
|
|
|
private:
|
|
int _fd;
|
|
int _pinno;
|
|
};
|
|
}
|
|
#endif
|