| 1 | /** |
| 2 | * @file gpio.h |
| 3 | * Class declaration for SPI helper files |
| 4 | */ |
| 5 | |
| 6 | /** |
| 7 | * Example of gpio.h class declaration for GPIO portability |
| 8 | * |
| 9 | * @defgroup Porting_GPIO Porting: GPIO |
| 10 | * @{ |
| 11 | */ |
| 12 | #ifndef RF24_UTILITY_TEMPLATE_GPIO_H_ |
| 13 | #define RF24_UTILITY_TEMPLATE_GPIO_H_ |
| 14 | |
| 15 | #include <cstdio> |
| 16 | |
| 17 | #ifndef DOXYGEN_FORCED |
| 18 | // exclude this line from the docs to prevent displaying in the list of classes |
| 19 | class GPIO |
| 20 | #endif |
| 21 | { |
| 22 | |
| 23 | public: |
| 24 | /* Constants */ |
| 25 | static const int DIRECTION_OUT = 1; |
| 26 | static const int DIRECTION_IN = 0; |
| 27 | |
| 28 | static const int OUTPUT_HIGH = 1; |
| 29 | static const int OUTPUT_LOW = 0; |
| 30 | |
| 31 | GPIO(); |
| 32 | |
| 33 | /** |
| 34 | * Similar to Arduino pinMode(pin,mode); |
| 35 | * @param port |
| 36 | * @param DDR |
| 37 | */ |
| 38 | static void open(int port, int DDR); |
| 39 | |
| 40 | /** |
| 41 | * |
| 42 | * @param port |
| 43 | */ |
| 44 | static void close(int port); |
| 45 | |
| 46 | /** |
| 47 | * Similar to Arduino digitalRead(pin); |
| 48 | * @param port |
| 49 | */ |
| 50 | static int read(int port); |
| 51 | |
| 52 | /** |
| 53 | * Similar to Arduino digitalWrite(pin,state); |
| 54 | * @param port |
| 55 | * @param value |
| 56 | */ |
| 57 | static void write(int port, int value); |
| 58 | |
| 59 | #ifndef DOXYGEN_FORCED |
| 60 | // exclude this line from the docs to prevent warnings docs generators |
| 61 | virtual ~GPIO(); |
| 62 | #endif |
| 63 | }; |
| 64 | |
| 65 | /**@}*/ |
| 66 | |
| 67 | #endif // RF24_UTILITY_TEMPLATE_GPIO_H_ |