MySensors Library & Examples  2.3.2
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-2019 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 #define IRQ_HANDLER_ATTR ICACHE_RAM_ATTR
47 #else
48 #define IRQ_HANDLER_ATTR
49 #endif
50 
51 // Implement these as functions or macros
52 /*
53 #define hwInit() MY_SERIALDEVICE.begin(BAUD_RATE)
54 #define hwWatchdogReset() wdt_reset()
55 #define hwReboot() wdt_enable(WDTO_15MS); while (1)
56 #define hwMillis() millis()
57 
58 #define hwDigitalWrite(__pin, __value)
59 #define hwDigitalRead(__pin)
60 #define hwPinMode(__pin, __value)
61 
62 void hwReadConfigBlock(void *buf, void *addr, size_t length);
63 void hwWriteConfigBlock(void *buf, void *addr, size_t length);
64 void hwWriteConfig(const int addr, uint8_t value);
65 uint8_t hwReadConfig(const int addr);
66 */
67 
74 //#define MY_HW_HAS_GETENTROPY
75 
77 typedef uint8_t unique_id_t[16];
78 
84 int8_t hwSleep(uint32_t ms);
85 
93 int8_t hwSleep(const uint8_t interrupt, const uint8_t mode, uint32_t ms);
94 
104 int8_t hwSleep(const uint8_t interrupt1, const uint8_t mode1, const uint8_t interrupt2,
105  const uint8_t mode2,
106  uint32_t ms);
107 
113 bool hwUniqueID(unique_id_t *uniqueID);
114 
119 uint16_t hwCPUVoltage(void);
120 
125 uint16_t hwCPUFrequency(void);
126 
132 int8_t hwCPUTemperature(void);
133 
138 uint16_t hwFreeMem(void);
139 
140 #if defined(DEBUG_OUTPUT_ENABLED)
141 
145 void hwDebugPrint(const char *fmt, ...);
151 static void hwDebugBuf2Str(const uint8_t *buf, size_t sz) __attribute__((unused));
152 #endif
153 
182 #ifdef DOXYGEN
183 #define MY_CRITICAL_SECTION
184 #define MY_HW_HAS_GETENTROPY
185 #endif /* DOXYGEN */
186 
187 #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:77
hwSleep
int8_t hwSleep(uint32_t ms)
hwCPUVoltage
uint16_t hwCPUVoltage(void)
hwCPUFrequency
uint16_t hwCPUFrequency(void)