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.

Arduino.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 Arduino_h
  20. #define Arduino_h
  21. #include <stdlib.h>
  22. #include <stdint.h>
  23. #include <stdbool.h>
  24. #include <stddef.h>
  25. #include <stdarg.h>
  26. #include <stdio.h>
  27. #include <string.h>
  28. #include <math.h>
  29. #include <string>
  30. #include <algorithm>
  31. #include "stdlib_noniso.h"
  32. #ifdef LINUX_ARCH_RASPBERRYPI
  33. #include "RPi.h"
  34. #define pinMode(pin, direction) RPi.pinMode(pin, direction)
  35. #define digitalWrite(pin, value) RPi.digitalWrite(pin, value)
  36. #define digitalRead(pin) RPi.digitalRead(pin)
  37. #define digitalPinToInterrupt(pin) RPi.digitalPinToInterrupt(pin)
  38. #else
  39. #include "GPIO.h"
  40. #define pinMode(pin, direction) GPIO.pinMode(pin, direction)
  41. #define digitalWrite(pin, value) GPIO.digitalWrite(pin, value)
  42. #define digitalRead(pin) GPIO.digitalRead(pin)
  43. #define digitalPinToInterrupt(pin) GPIO.digitalPinToInterrupt(pin)
  44. #endif
  45. #include "interrupt.h"
  46. #undef PSTR
  47. #define PSTR(x) (x)
  48. #undef F
  49. #define F(x) (x)
  50. #define PROGMEM __attribute__(( section(".progmem.data") ))
  51. #define vsnprintf_P(...) vsnprintf( __VA_ARGS__ )
  52. #define snprintf_P(...) snprintf( __VA_ARGS__ )
  53. #define memcpy_P memcpy
  54. #define pgm_read_byte(p) (*(p))
  55. #define pgm_read_dword(p) (*(p))
  56. #define pgm_read_byte_near(p) (*(p))
  57. #define PI 3.1415926535897932384626433832795
  58. #define HALF_PI 1.5707963267948966192313216916398
  59. #define TWO_PI 6.283185307179586476925286766559
  60. #define DEG_TO_RAD 0.017453292519943295769236907684886
  61. #define RAD_TO_DEG 57.295779513082320876798154814105
  62. #define EULER 2.718281828459045235360287471352
  63. #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
  64. #define radians(deg) ((deg)*DEG_TO_RAD)
  65. #define degrees(rad) ((rad)*RAD_TO_DEG)
  66. #define sq(x) ((x)*(x))
  67. #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
  68. #define lowByte(w) ((uint8_t) ((w) & 0xff))
  69. #define highByte(w) ((uint8_t) ((w) >> 8))
  70. #define bitRead(value, bit) (((value) >> (bit)) & 0x01)
  71. #define bitSet(value, bit) ((value) |= (1UL << (bit)))
  72. #define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
  73. #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
  74. #define bit(b) (1UL << (b))
  75. #define GET_MACRO(_0, _1, _2, NAME, ...) NAME
  76. #define random(...) GET_MACRO(_0, ##__VA_ARGS__, randMinMax, randMax, rand)(__VA_ARGS__)
  77. #ifndef delay
  78. #define delay _delay_milliseconds
  79. #endif
  80. #ifndef delayMicroseconds
  81. #define delayMicroseconds _delay_microseconds
  82. #endif
  83. using std::string;
  84. using std::min;
  85. using std::max;
  86. using std::abs;
  87. typedef uint8_t byte;
  88. typedef string String;
  89. typedef char __FlashStringHelper;
  90. void yield(void);
  91. unsigned long millis(void);
  92. unsigned long micros(void);
  93. void _delay_milliseconds(unsigned int millis);
  94. void _delay_microseconds(unsigned int micro);
  95. void randomSeed(unsigned long seed);
  96. long randMax(long howbig);
  97. long randMinMax(long howsmall, long howbig);
  98. #endif