Created
January 12, 2020 20:03
-
-
Save colesnicov/6321ee1ac9770407761692dd8c21a272 to your computer and use it in GitHub Desktop.
With these functions, any data can be cleaned from the PGM space.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @licence WTFPL | |
* | |
*/ | |
#pragma once | |
#include "avr/pgmspace.h" | |
template<typename T> void PROGMEM_readAnything(const T * source, T& dest) | |
{ | |
memcpy_P(&dest, source, sizeof(T)); | |
} | |
template<typename T> T PROGMEM_getAnything(const T * source) | |
{ | |
static T temp; | |
memcpy_P(&temp, source, sizeof(T)); | |
return temp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment