Hi there,
trying to port over some code from an MEGA2560 to Teensy 3.0.
It makes use of the Freetronics FTOLED library.
I come unstuck when I try to include this library:
The progmem_compat.h file is as follows:
I guess this is failing because I need to somehow define the Teensy 3.0 version of "PROGMEM" ? I was reading about this elsewhere in these forums but I don't quite understand what I am to do to get this to work.
From what I can tell Teensy doesn't require us to use the PROGMEM functions, rather we just declare using const and the variables go into flash.... wondering how I could make the above code compile though...
trying to port over some code from an MEGA2560 to Teensy 3.0.
It makes use of the Freetronics FTOLED library.
I come unstuck when I try to include this library:
Code:
C:\Program Files (x86)\Arduino\hardware\tools\arm-none-eabi\bin\arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=48000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -mthumb -nostdlib -D__MK20DX128__ -fno-rtti -felide-constructors -std=gnu++0x -DUSB_SERIAL -DLAYOUT_US_ENGLISH -IC:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3 -IC:\Program Files (x86)\Arduino\libraries\SPI -IC:\Program Files (x86)\Arduino\libraries\SD -IC:\Users\adrian\Documents\Arduino\libraries\FTOLED C:\Users\adrian\AppData\Local\Temp\build5676235364811397403.tmp\EchoBoth.cpp -o C:\Users\adrian\AppData\Local\Temp\build5676235364811397403.tmp\EchoBoth.cpp.o
In file included from C:\Users\adrian\Documents\Arduino\libraries\FTOLED/FTOLED.h:42:0,
from EchoBoth.pde:10:
C:\Users\adrian\Documents\Arduino\libraries\FTOLED/progmem_compat.h:17:0: warning: "memcpy_P" redefined [enabled by default]
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/WProgram.h:11:0,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Arduino.h:1,
from C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:15,
from EchoBoth.pde:8:
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/avr/pgmspace.h:22:0: note: this is the location of the previous definition
In file included from C:\Users\adrian\Documents\Arduino\libraries\FTOLED/FTOLED.h:42:0,
from EchoBoth.pde:10:
C:\Users\adrian\Documents\Arduino\libraries\FTOLED/progmem_compat.h:21:0: warning: "F" redefined [enabled by default]
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Print.h:37:0,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Stream.h:24,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/HardwareSerial.h:87,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/WProgram.h:16,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Arduino.h:1,
from C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:15,
from EchoBoth.pde:8:
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/WString.h:41:0: note: this is the location of the previous definition
In file included from C:\Users\adrian\Documents\Arduino\libraries\FTOLED/FTOLED.h:42:0,
from EchoBoth.pde:10:
C:\Users\adrian\Documents\Arduino\libraries\FTOLED/progmem_compat.h:19:23: error: expected unqualified-id before 'const'
C:\Users\adrian\Documents\Arduino\libraries\FTOLED/progmem_compat.h:19:23: error: expected ')' before 'const'
C:\Users\adrian\Documents\Arduino\libraries\FTOLED/progmem_compat.h:19:23: error: expected ')' before 'const'
The progmem_compat.h file is as follows:
Code:
/*
* A header file designed to provide PROGMEM compatible (no-op) macros for
* Arduino Due or other non-AVR based boards.
*
* This allows code written to use PROGMEM on AVRs to transparently run on
* other platforms
*
* This header is necessary on Arduino 1.5.1 & 1.5.2 betas, from 1.5.3
* the Arduino team added their own wrappers so this header file does
* nothing.
*/
#ifndef _PROGMEM_COMPAT_H
#define _PROGMEM_COMPAT_H
#if defined(__AVR__) || (defined(ARDUINO) && ARDUINO > 152)
#include <avr/pgmspace.h>
#else // ARM
// Stub out some other common PROGMEM functions
#define PROGMEM
#define memcpy_P memcpy
static inline uint8_t pgm_read_byte(const void *addr) { return *((uint8_t *)addr); }
#define F(X) X
#endif
#endif
I guess this is failing because I need to somehow define the Teensy 3.0 version of "PROGMEM" ? I was reading about this elsewhere in these forums but I don't quite understand what I am to do to get this to work.
From what I can tell Teensy doesn't require us to use the PROGMEM functions, rather we just declare using const and the variables go into flash.... wondering how I could make the above code compile though...