Skip to content

Commit

Permalink
Fix for constant string storage on Arduinos.
Browse files Browse the repository at this point in the history
For Arduinos we can use the F(..) macro which casts the string to a streamable helper class.
  • Loading branch information
denravonska committed Dec 6, 2016
1 parent 90b2861 commit 6cf0e29
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion N2kDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ extern uint32_t millis();
#ifdef __AVR__
// AVR8 uses progmem.
#include <avr/pgmspace.h>
#define CSTR(str) str PROGMEM

// Utilize the string helper on Arduino platforms.
#ifdef ARDUINO
#include <Arduino.h>
#define CSTR(str) F(str)
#else
#define CSTR(str) PSTR(str)
#endif
#define CDATA(data) data PROGMEM
#define GET_CINT8(var) pgm_read_byte(&var)
#define GET_CINT16(var) pgm_read_word(&var)
Expand Down

0 comments on commit 6cf0e29

Please sign in to comment.