Smart-Home am Beispiel der Präsenzerkennung im Raum Projektarbeit Lennart Heimbs, Johannes Krug, Sebastian Dohle und Kevin Holzschuh bei Prof. Oliver Hofmann SS2019
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GPIO.h 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 <henrik.ekblad@mysensors.org>
  9. * Copyright (C) 2013-2018 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. #ifndef GPIO_h
  20. #define GPIO_h
  21. #include <stdint.h>
  22. #define INPUT 0
  23. #define OUTPUT 1
  24. #define LOW 0
  25. #define HIGH 1
  26. /**
  27. * @brief GPIO class
  28. */
  29. class GPIOClass
  30. {
  31. public:
  32. /**
  33. * @brief GPIOClass constructor.
  34. */
  35. GPIOClass();
  36. /**
  37. * @brief GPIOClass copy constructor.
  38. */
  39. GPIOClass(const GPIOClass& other);
  40. /**
  41. * @brief GPIOClass destructor.
  42. */
  43. ~GPIOClass();
  44. /**
  45. * @brief Configures the specified pin to behave either as an input or an output.
  46. *
  47. * @param pin The number of the pin.
  48. * @param mode INPUT or OUTPUT.
  49. */
  50. void pinMode(uint8_t pin, uint8_t mode);
  51. /**
  52. * @brief Write a high or a low value for the given pin.
  53. *
  54. * @param pin number.
  55. * @param value HIGH or LOW.
  56. */
  57. void digitalWrite(uint8_t pin, uint8_t value);
  58. /**
  59. * @brief Reads the value from a specified pin.
  60. *
  61. * @param pin The number of the pin.
  62. * @return HIGH or LOW.
  63. */
  64. uint8_t digitalRead(uint8_t pin);
  65. /**
  66. * @brief Arduino compatibility function, returns the same given pin.
  67. *
  68. * @param pin The number of the pin.
  69. * @return The same parameter pin number.
  70. */
  71. uint8_t digitalPinToInterrupt(uint8_t pin);
  72. /**
  73. * @brief Overloaded assign operator.
  74. *
  75. */
  76. GPIOClass& operator=(const GPIOClass& other);
  77. private:
  78. int lastPinNum; //!< @brief Highest pin number supported.
  79. uint8_t *exportedPins; //!< @brief Array with information of which pins were exported.
  80. };
  81. extern GPIOClass GPIO;
  82. #endif