整理代码
This commit is contained in:
commit
c7b4e178ec
364 changed files with 59691 additions and 0 deletions
44
hardware/GPIO.h
Normal file
44
hardware/GPIO.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue