MySensors Library & Examples  2.3.2
GPIO.h
1 /*
2  * The MySensors Arduino library handles the wireless radio link and protocol
3  * between your home built sensors/actuators and HA controller of choice.
4  * The sensors forms a self healing radio network with optional repeaters. Each
5  * repeater and gateway builds a routing tables in EEPROM which keeps track of the
6  * network topology allowing messages to be routed to nodes.
7  *
8  * Created by Henrik Ekblad <[email protected]>
9  * Copyright (C) 2013-2019 Sensnology AB
10  * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
11  *
12  * Documentation: http://www.mysensors.org
13  * Support Forum: http://forum.mysensors.org
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * version 2 as published by the Free Software Foundation.
18  */
19 
20 #ifndef GPIO_h
21 #define GPIO_h
22 
23 #include <stdint.h>
24 
25 #define INPUT 0
26 #define OUTPUT 1
27 
28 #define LOW 0
29 #define HIGH 1
30 
34 class GPIOClass
35 {
36 
37 public:
41  GPIOClass();
45  GPIOClass(const GPIOClass& other);
49  ~GPIOClass();
56  void pinMode(uint8_t pin, uint8_t mode);
63  void digitalWrite(uint8_t pin, uint8_t value);
70  uint8_t digitalRead(uint8_t pin);
77  uint8_t digitalPinToInterrupt(uint8_t pin);
82  GPIOClass& operator=(const GPIOClass& other);
83 
84 private:
85  int lastPinNum;
86  uint8_t *exportedPins;
87 };
88 
89 extern GPIOClass GPIO;
90 
91 #endif
GPIOClass::digitalWrite
void digitalWrite(uint8_t pin, uint8_t value)
Write a high or a low value for the given pin.
GPIOClass
GPIO class.
Definition: GPIO.h:34
GPIOClass::GPIOClass
GPIOClass()
GPIOClass constructor.
GPIOClass::digitalPinToInterrupt
uint8_t digitalPinToInterrupt(uint8_t pin)
Arduino compatibility function, returns the same given pin.
GPIOClass::operator=
GPIOClass & operator=(const GPIOClass &other)
Overloaded assign operator.
GPIOClass::digitalRead
uint8_t digitalRead(uint8_t pin)
Reads the value from a specified pin.
GPIOClass::pinMode
void pinMode(uint8_t pin, uint8_t mode)
Configures the specified pin to behave either as an input or an output.
GPIOClass::~GPIOClass
~GPIOClass()
GPIOClass destructor.