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.

MyHwTeensy3.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. * Radio wiring Teensy3.x: RF24, RFM69, RFM95:
  20. * MISO 12
  21. * MOSI 11
  22. * SCK 13
  23. * CSN 10
  24. * CE 9 (RF24)
  25. * IRQ 8 (opt. RF24, RFM69, RFM95)
  26. */
  27. #ifndef MyHwTeensy3_h
  28. #define MyHwTeensy3_h
  29. #ifdef __cplusplus
  30. #include <Arduino.h>
  31. #endif
  32. #include "util/atomic.h"
  33. #define CRYPTO_LITTLE_ENDIAN
  34. #ifndef MY_SERIALDEVICE
  35. #define MY_SERIALDEVICE Serial
  36. #endif
  37. #ifndef MY_DEBUGDEVICE
  38. #define MY_DEBUGDEVICE MY_SERIALDEVICE
  39. #endif
  40. #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
  41. #define RNG_CR_GO_MASK 0x1u
  42. #define RNG_CR_HA_MASK 0x2u
  43. #define RNG_CR_INTM_MASK 0x4u
  44. #define RNG_CR_CLRI_MASK 0x8u
  45. #define RNG_CR_SLP_MASK 0x10u
  46. #define RNG_SR_OREG_LVL_MASK 0xFF00u
  47. #define RNG_SR_OREG_LVL_SHIFT 8
  48. #define RNG_SR_OREG_LVL(x) (((uint32_t)(((uint32_t)(x))<<RNG_SR_OREG_LVL_SHIFT))&RNG_SR_OREG_LVL_MASK)
  49. #define SIM_SCGC6_RNGA ((uint32_t)0x00000200)
  50. #endif
  51. // Define these as macros to save valuable space
  52. #define hwDigitalWrite(__pin, __value) digitalWriteFast(__pin, __value)
  53. #define hwDigitalRead(__pin) digitalReadFast(__pin)
  54. #define hwPinMode(__pin, __value) pinMode(__pin, __value)
  55. #define hwMillis() millis()
  56. void hwRandomNumberInit(void);
  57. bool hwInit(void);
  58. void hwWatchdogReset(void);
  59. void hwReboot(void);
  60. // Teensy 3.x implements avr-libc EEPROM API
  61. #define hwReadConfig(__pos) eeprom_read_byte((const uint8_t *)__pos)
  62. #define hwWriteConfig(__pos, __val) eeprom_update_byte((uint8_t *)__pos, (uint8_t)__val)
  63. #define hwReadConfigBlock(__buf, __pos, __length) eeprom_read_block((void *)__buf, (const void *)__pos, (uint32_t)__length)
  64. #define hwWriteConfigBlock(__buf, __pos, __length) eeprom_update_block((const void *)__buf, (void *)__pos, (uint32_t)__length)
  65. #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
  66. #define MY_HW_HAS_GETENTROPY
  67. #endif
  68. #define MY_CRITICAL_SECTION ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
  69. #endif