mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2024-10-03 18:18:46 -04:00
Improved(?) 32-bit CPU compatibility for fonts
This commit is contained in:
parent
9ec1f6d4ee
commit
c349ad5e4f
@ -31,17 +31,34 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "Adafruit_GFX.h"
|
||||
#include "glcdfont.c"
|
||||
#ifdef __AVR__
|
||||
#include <avr/pgmspace.h>
|
||||
#define pgm_read_pointer(addr) ((void *)pgm_read_word(addr))
|
||||
#elif defined(ESP8266)
|
||||
#include <pgmspace.h>
|
||||
#endif
|
||||
#include "Adafruit_GFX.h"
|
||||
#include "glcdfont.c"
|
||||
|
||||
// Many (but maybe not all) non-AVR board installs define macros
|
||||
// for compatibility with existing PROGMEM-reading AVR code.
|
||||
// Do our own checks and defines here for good measure...
|
||||
|
||||
#ifndef pgm_read_byte
|
||||
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
|
||||
#endif
|
||||
#ifndef pgm_read_word
|
||||
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
|
||||
#endif
|
||||
#ifndef pgm_read_dword
|
||||
#define pgm_read_dword(addr) (*(const unsigned long *)(addr))
|
||||
#endif
|
||||
|
||||
// Pointers are a peculiar case...typically 16-bit on AVR boards,
|
||||
// 32 bits elsewhere. Try to accommodate both...
|
||||
|
||||
#if !defined(__INT_MAX__) || (__INT_MAX__ > 0xFFFF)
|
||||
#define pgm_read_pointer(addr) ((void *)pgm_read_dword(addr))
|
||||
#else
|
||||
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
|
||||
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
|
||||
#define pgm_read_pointer(addr) ((void *)pgm_read_word(addr))
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user