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.

MyHwAVR.h 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 MyHwAVR_h
  20. #define MyHwAVR_h
  21. #include <avr/eeprom.h>
  22. #include <avr/pgmspace.h>
  23. #include <avr/sleep.h>
  24. #include <avr/power.h>
  25. #include <avr/interrupt.h>
  26. #include <avr/wdt.h>
  27. #include <util/atomic.h>
  28. #ifdef __cplusplus
  29. #include <Arduino.h>
  30. #endif
  31. #define CRYPTO_LITTLE_ENDIAN
  32. #ifndef MY_SERIALDEVICE
  33. #define MY_SERIALDEVICE Serial
  34. #endif
  35. #ifndef MY_DEBUGDEVICE
  36. #define MY_DEBUGDEVICE MY_SERIALDEVICE
  37. #endif
  38. // AVR temperature calibration reference: http://ww1.microchip.com/downloads/en/AppNotes/Atmel-8108-Calibration-of-the-AVRs-Internal-Temperature-Reference_ApplicationNote_AVR122.pdf
  39. #ifndef MY_AVR_TEMPERATURE_OFFSET
  40. #define MY_AVR_TEMPERATURE_OFFSET (324.31f)
  41. #endif
  42. #ifndef MY_AVR_TEMPERATURE_GAIN
  43. #define MY_AVR_TEMPERATURE_GAIN (1.22f)
  44. #endif
  45. // Define these as macros to save valuable space
  46. #define hwDigitalWrite(__pin, __value) digitalWriteFast(__pin, __value)
  47. #define hwDigitalRead(__pin) digitalReadFast(__pin)
  48. #define hwPinMode(__pin, __value) pinModeFast(__pin, __value)
  49. bool hwInit(void);
  50. #define hwWatchdogReset() wdt_reset()
  51. #define hwReboot() wdt_enable(WDTO_15MS); while (1)
  52. #define hwMillis() millis()
  53. #define hwReadConfig(__pos) eeprom_read_byte((const uint8_t *)__pos)
  54. #define hwWriteConfig(__pos, __val) eeprom_update_byte((uint8_t *)__pos, (uint8_t)__val)
  55. #define hwReadConfigBlock(__buf, __pos, __length) eeprom_read_block((void *)__buf, (const void *)__pos, (uint32_t)__length)
  56. #define hwWriteConfigBlock(__buf, __pos, __length) eeprom_update_block((const void *)__buf, (void *)__pos, (uint32_t)__length)
  57. inline void hwRandomNumberInit(void);
  58. void hwInternalSleep(uint32_t ms);
  59. #ifndef DOXYGEN
  60. #define MY_CRITICAL_SECTION ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
  61. #endif /* DOXYGEN */
  62. #endif