-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPin.h
More file actions
31 lines (24 loc) · 658 Bytes
/
Pin.h
File metadata and controls
31 lines (24 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef pin_h
#define pin_h
#include "Arduino.h"
/**
* Pin
*
* Abstract base for classes representing specific numbered Arduino pins.
*/
class Pin {
protected:
byte m_pin;
Pin(byte pin): m_pin(pin) {}
public:
// Overloaded byte cast for compatibility with libraries expecting raw pin numbers.
operator byte() {
return m_pin;
}
private:
// Copy constructor and assignment operator are private, ensuring that each Pin is explicitly constructed
// just once at the beginning of a program, and only passed by reference thereafter.
Pin(const Pin& rhs);
Pin& operator=(const Pin& pin);
};
#endif