From 1189d809a6122c12bce719dc00970f8d180247ac Mon Sep 17 00:00:00 2001 From: Phil Hord Date: Mon, 13 Apr 2015 18:38:51 -0400 Subject: [PATCH] Simulator: add pgm_read_dword() macro. pgm_read_word() was already defined, but pgm_read_dword() did not get in our way during earlier testing. These functions force the arduino to read these "defined in program" constant arrays from "program memory" instead of RAM as a means to save on RAM usage. The PC-based simulator doesn't need such tricks and only needs to read the value directly from the in-RAM array. Therefore it is safe to convert read directly from the pointer being passed. pgm_read_word() already does this. Define pgm_read_dword() similarly to it. Fixes #125. --- simulator.h | 1 + 1 file changed, 1 insertion(+) diff --git a/simulator.h b/simulator.h index 5abcf47..7cd03fb 100644 --- a/simulator.h +++ b/simulator.h @@ -59,6 +59,7 @@ #define PSTR(x) (x) #define pgm_read_byte(x) (*((uint8_t *)(x))) #define pgm_read_word(x) (*((uint16_t *)(x))) +#define pgm_read_dword(x) (*((uint32_t *)(x))) #define MASK(PIN) (1 << PIN) #define ACD 7