MySensors Library & Examples  2.3.2-62-ge298769
MyHwHAL.h
Go to the documentation of this file.
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 <[email protected]>
9  * Copyright (C) 2013-2022 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 
26 #ifndef MyHwHAL_h
27 #define MyHwHAL_h
28 
33 #define INVALID_INTERRUPT_NUM (0xFFu)
34 
39 #define MY_HWID_PADDING_BYTE (0xAAu)
40 
45 #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
46 #if defined(ARDUINO_ARCH_ESP8266) && ARDUINO_ESP8266_MAJOR == 3
47 #define IRQ_HANDLER_ATTR IRAM_ATTR
48 #else
49 #define IRQ_HANDLER_ATTR ICACHE_RAM_ATTR
50 #endif
51 #else
52 #define IRQ_HANDLER_ATTR
53 #endif
54 
55 // Implement these as functions or macros
56 /*
57 #define hwInit() MY_SERIALDEVICE.begin(BAUD_RATE)
58 #define hwWatchdogReset() wdt_reset()
59 #define hwReboot() wdt_enable(WDTO_15MS); while (1)
60 #define hwMillis() millis()
61 
62 #define hwDigitalWrite(__pin, __value)
63 #define hwDigitalRead(__pin)
64 #define hwPinMode(__pin, __value)
65 
66 void hwReadConfigBlock(void *buf, void *addr, size_t length);
67 void hwWriteConfigBlock(void *buf, void *addr, size_t length);
68 void hwWriteConfig(const int addr, uint8_t value);
69 uint8_t hwReadConfig(const int addr);
70 */
71 
78 //#define MY_HW_HAS_GETENTROPY
79 
81 typedef uint8_t unique_id_t[16];
82 
88 int8_t hwSleep(uint32_t ms);
89 
97 int8_t hwSleep(const uint8_t interrupt, const uint8_t mode, uint32_t ms);
98 
108 int8_t hwSleep(const uint8_t interrupt1, const uint8_t mode1, const uint8_t interrupt2,
109  const uint8_t mode2,
110  uint32_t ms);
111 
117 bool hwUniqueID(unique_id_t *uniqueID);
118 
123 uint16_t hwCPUVoltage(void);
124 
129 uint16_t hwCPUFrequency(void);
130 
136 int8_t hwCPUTemperature(void);
137 
142 uint16_t hwFreeMem(void);
143 
144 #if defined(DEBUG_OUTPUT_ENABLED)
145 
149 void hwDebugPrint(const char *fmt, ...);
155 static void hwDebugBuf2Str(const uint8_t *buf, size_t sz) __attribute__((unused));
156 #endif
157 
186 #ifdef DOXYGEN
187 #define MY_CRITICAL_SECTION
188 #define MY_HW_HAS_GETENTROPY
189 #endif /* DOXYGEN */
190 
191 #endif // #ifdef MyHw_h
hwFreeMem
uint16_t hwFreeMem(void)
hwUniqueID
bool hwUniqueID(unique_id_t *uniqueID)
hwCPUTemperature
int8_t hwCPUTemperature(void)
__attribute__
struct @4::@5 __attribute__
Doxygen will complain without this comment.
Definition: DigitalPin.h:65
unique_id_t
uint8_t unique_id_t[16]
unique ID
Definition: MyHwHAL.h:81
hwSleep
int8_t hwSleep(uint32_t ms)
hwCPUVoltage
uint16_t hwCPUVoltage(void)
hwCPUFrequency
uint16_t hwCPUFrequency(void)