Solve the pgmspace.h problem centrally.

We previously put replacements for the von Neuman architecture
into arduino.h already, now let's complete this by having only
one #include <avr/pgmspace.h> in arduino.h. Almost all sources
include arduino.h anyways, so this is mostly a code reduction.
This commit is contained in:
Markus Hitter 2015-07-12 22:57:19 +02:00
parent 52f5a56d71
commit ce40b678f6
6 changed files with 9 additions and 21 deletions

View File

@ -71,14 +71,20 @@
For the AVR definitions, see /usr/lib/avr/include/avr/pgmspace.h on Linux.
*/
#ifndef __AVR__
#ifdef __AVR__
#include <avr/pgmspace.h>
#else
#define PROGMEM
#define PGM_P const char *
#define PSTR(s) ((const PROGMEM char *)(s))
#define pgm_read_byte(x) (*((uint8_t *)(x)))
#define pgm_read_word(x) (*((uint16_t *)(x)))
#define pgm_read_dword(x) (*((uint32_t *)(x)))
#endif /* ! __AVR__ */
#endif /* __AVR__, ! __AVR__ */
/*
ports and functions

9
dda.h
View File

@ -11,15 +11,6 @@
#endif
#endif
#ifndef SIMULATOR
#include <avr/pgmspace.h>
#else
#define PROGMEM
#endif
/*
types
*/
// Enum to denote an axis
enum axis_e { X = 0, Y, Z, E, AXIS_COUNT };

View File

@ -6,7 +6,6 @@
#include <stdlib.h>
#include <avr/eeprom.h>
#include <avr/pgmspace.h>
#include "arduino.h"
#include "debug.h"

View File

@ -3,9 +3,6 @@
#include "config_wrapper.h"
#include <stdint.h>
#ifdef __AVR__
#include <avr/pgmspace.h>
#endif
#include "simulator.h"
#ifdef USB_SERIAL

View File

@ -5,9 +5,6 @@
*/
#include <stdarg.h>
#ifndef SIMULATOR
#include <avr/pgmspace.h>
#endif
#include "serial.h"
#include "sermsg.h"

View File

@ -1,11 +1,9 @@
#ifndef _SERSENDF_H
#define _SERSENDF_H
#ifndef SIMULATOR
#include <avr/pgmspace.h>
#endif
#include "arduino.h"
void sersendf(char *format, ...) __attribute__ ((format (printf, 1, 2)));
void sersendf_P(PGM_P format_P, ...) __attribute__ ((format (printf, 1, 2)));