Commit | Line | Data |
---|---|---|
7064cca7 MM |
1 | #ifndef _GPIO_HPP |
2 | #define _GPIO_HPP | |
3 | ||
4 | #include <stdint.h> | |
5 | ||
6 | #define GPIO_DIR_INPUT 0 | |
7 | #define GPIO_DIR_OUTPUT 1 | |
8 | ||
9 | #include <PinNames.h> | |
10 | ||
11 | class GPIO { | |
12 | public: | |
13 | uint8_t port; | |
14 | uint8_t pin; | |
15 | GPIO(PinName); | |
16 | GPIO(uint8_t port, uint8_t pin); | |
17 | GPIO(uint8_t port, uint8_t pin, uint8_t direction); | |
18 | // ~GPIO(); | |
19 | void setup(); | |
20 | void set_direction(uint8_t direction); | |
21 | void output(); | |
22 | void input(); | |
23 | void write(uint8_t value); | |
24 | void set(); | |
25 | void clear(); | |
26 | uint8_t get(); | |
27 | ||
28 | int operator=(int); | |
29 | }; | |
30 | ||
31 | #endif /* _GPIO_HPP */ |