MySensors hardware abstraction layer
Definition in file MyHwHAL.h.
Go to the source code of this file.
|
#define | INVALID_INTERRUPT_NUM (0xFFu) |
| Invalid interrupt.
|
|
#define | MY_HWID_PADDING_BYTE (0xAAu) |
| HwID padding byte.
|
|
#define | IRQ_HANDLER_ATTR |
| ESP8266/ESP32 IRQ handlers need to be stored in IRAM.
|
|
#define | MY_CRITICAL_SECTION |
| Creates a block of code that is guaranteed to be executed atomically. Upon entering the block all interrupts are disabled, and re-enabled upon exiting the block from any exit path. A typical example that requires atomic access is a 16 (or more) bit variable that is shared between the main execution path and an ISR, on an 8-bit platform (e.g AVR): More...
|
|
#define | MY_HW_HAS_GETENTROPY |
| Define this, if hwGetentropy is implemented. More...
|
|
◆ MY_CRITICAL_SECTION
#define MY_CRITICAL_SECTION |
Creates a block of code that is guaranteed to be executed atomically. Upon entering the block all interrupts are disabled, and re-enabled upon exiting the block from any exit path. A typical example that requires atomic access is a 16 (or more) bit variable that is shared between the main execution path and an ISR, on an 8-bit platform (e.g AVR):
volatile uint16_t val = 0;
void interrupHandler()
{
val = ~val;
}
{
uint16_t copy_val;
{
copy_val = val;
}
}
All code within the MY_CRITICAL_SECTION block will be protected from being interrupted during execution.
Definition at line 187 of file MyHwHAL.h.
◆ MY_HW_HAS_GETENTROPY
#define MY_HW_HAS_GETENTROPY |
Define this, if hwGetentropy is implemented.
ssize_t hwGetentropy(void *__buffer, size_t __length);
Definition at line 188 of file MyHwHAL.h.
◆ hwCPUFrequency()
uint16_t hwCPUFrequency |
( |
void |
| ) |
|
CPU frequency
- Returns
- CPU frequency in 1/10Mhz
◆ hwCPUTemperature()
int8_t hwCPUTemperature |
( |
void |
| ) |
|
CPU temperature (if available) Adjust calibration parameters via MY_<ARCH>_TEMPERATURE_OFFSET and MY_<ARCH>_TEMPERATURE_GAIN
- Returns
- CPU temperature in °C, -127 if not available
◆ hwCPUVoltage()
uint16_t hwCPUVoltage |
( |
void |
| ) |
|
CPU voltage
- Returns
- CPU voltage in mV
◆ hwFreeMem()
uint16_t hwFreeMem |
( |
void |
| ) |
|
Report free memory (if function available)
- Returns
- free memory in bytes
◆ hwSleep() [1/3]
int8_t hwSleep |
( |
const uint8_t |
interrupt, |
|
|
const uint8_t |
mode, |
|
|
uint32_t |
ms |
|
) |
| |
Sleep for a defined time, using minimum power, or until woken by interrupt.
- Parameters
-
interrupt | Interrupt number, which can wake the mcu from sleep. |
mode | Interrupt mode, as passed to attachInterrupt. |
ms | Time to sleep, in [ms]. |
- Returns
- MY_WAKE_UP_BY_TIMER when woken by timer, or interrupt number when woken by interrupt.
◆ hwSleep() [2/3]
int8_t hwSleep |
( |
const uint8_t |
interrupt1, |
|
|
const uint8_t |
mode1, |
|
|
const uint8_t |
interrupt2, |
|
|
const uint8_t |
mode2, |
|
|
uint32_t |
ms |
|
) |
| |
Sleep for a defined time, using minimum power, or until woken by one of the interrupts.
- Parameters
-
interrupt1 | Interrupt1 number, which can wake the mcu from sleep. |
mode1 | Interrupt1 mode, as passed to attachInterrupt. |
interrupt2 | Interrupt2 number, which can wake the mcu from sleep. |
mode2 | Interrupt2 mode, as passed to attachInterrupt. |
ms | Time to sleep, in [ms]. |
- Returns
- MY_WAKE_UP_BY_TIMER when woken by timer, or interrupt number when woken by interrupt.
◆ hwSleep() [3/3]
int8_t hwSleep |
( |
uint32_t |
ms | ) |
|
Sleep for a defined time, using minimum power.
- Parameters
-
ms | Time to sleep, in [ms]. |
- Returns
- MY_WAKE_UP_BY_TIMER.
◆ hwUniqueID()
Retrieve unique hardware ID
- Parameters
-
- Returns
- True if unique ID successfully retrieved
- Examples
- SecurityPersonalizer.ino.