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.

RPi.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 RPi_h
  20. #define RPi_h
  21. #include <stdint.h>
  22. #include "BCM.h"
  23. /**
  24. * @brief RPi class
  25. */
  26. class RPiClass
  27. {
  28. public:
  29. /**
  30. * @brief Configures the specified pin to behave either as an input or an output.
  31. *
  32. * @param physPin The physical number of the pin.
  33. * @param mode INPUT or OUTPUT.
  34. */
  35. void pinMode(uint8_t physPin, uint8_t mode);
  36. /**
  37. * @brief Write a high or a low value for the given pin.
  38. *
  39. * @param physPin The physical number of the pin.
  40. * @param value HIGH or LOW.
  41. */
  42. void digitalWrite(uint8_t physPin, uint8_t value);
  43. /**
  44. * @brief Reads the value from a specified pin.
  45. *
  46. * @param physPin The physical number of the pin.
  47. * @return HIGH or LOW.
  48. */
  49. uint8_t digitalRead(uint8_t physPin);
  50. /**
  51. * @brief Translate the physical pin number to the GPIO number for use in interrupt.
  52. *
  53. * @param physPin The physical number of the pin.
  54. * @return The GPIO pin number.
  55. */
  56. uint8_t digitalPinToInterrupt(uint8_t physPin);
  57. /**
  58. * @brief Translate the physical pin number to the GPIO number.
  59. *
  60. * @param physPin The physical number of the pin.
  61. * @param gpio Pointer to write the GPIO pin number when success.
  62. * @return -1 if FAILURE or 0 if SUCCESS.
  63. */
  64. static int physToGPIO(uint8_t physPin, uint8_t *gpio);
  65. private:
  66. static const int *phys_to_gpio; //!< @brief Pointer to array of GPIO pins numbers.
  67. /**
  68. * @brief Get the gpio layout.
  69. *
  70. * @return The gpio layout number.
  71. */
  72. static int rpiGpioLayout(void);
  73. };
  74. extern RPiClass RPi;
  75. #endif