2009-08-28 23:08:52 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-08-11 02:45:28 +04:00
|
|
|
#ifndef _DIGITAL_PORT_H
|
|
|
|
#define _DIGITAL_PORT_H
|
|
|
|
|
|
|
|
#include <BeBuild.h>
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
2009-08-28 23:08:52 +04:00
|
|
|
#include <stddef.h>
|
2002-08-11 02:45:28 +04:00
|
|
|
|
|
|
|
|
2009-08-28 23:08:52 +04:00
|
|
|
class BDigitalPort {
|
2002-08-11 02:45:28 +04:00
|
|
|
public:
|
2009-08-28 23:08:52 +04:00
|
|
|
BDigitalPort();
|
|
|
|
virtual ~BDigitalPort();
|
2002-08-11 02:45:28 +04:00
|
|
|
|
2009-08-28 23:08:52 +04:00
|
|
|
status_t Open(const char* portName);
|
|
|
|
void Close();
|
|
|
|
bool IsOpen();
|
2002-08-11 02:45:28 +04:00
|
|
|
|
2009-08-28 23:08:52 +04:00
|
|
|
ssize_t Read(uint8* buf);
|
|
|
|
ssize_t Write(uint8 value);
|
2002-08-11 02:45:28 +04:00
|
|
|
|
2009-08-28 23:08:52 +04:00
|
|
|
status_t SetAsOutput();
|
|
|
|
bool IsOutput();
|
2002-08-11 02:45:28 +04:00
|
|
|
|
2009-08-28 23:08:52 +04:00
|
|
|
status_t SetAsInput();
|
|
|
|
bool IsInput();
|
2002-08-11 02:45:28 +04:00
|
|
|
|
|
|
|
private:
|
2009-08-28 23:08:52 +04:00
|
|
|
virtual void _ReservedDigitalPort1();
|
|
|
|
virtual void _ReservedDigitalPort2();
|
|
|
|
virtual void _ReservedDigitalPort3();
|
2002-08-11 02:45:28 +04:00
|
|
|
|
2009-08-28 23:08:52 +04:00
|
|
|
int fFd;
|
|
|
|
bool fIsInput;
|
|
|
|
uint32 _fReserved[3];
|
2002-08-11 02:45:28 +04:00
|
|
|
};
|
|
|
|
|
2009-08-28 23:08:52 +04:00
|
|
|
#endif // _DIGITAL_PORT_H
|
|
|
|
|