-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As the Arduino IDE team has not yet released 1.6.6 with C++11 support. This patch allows regression to older standards. Some C++11 features will be unavailable, like streaming.
- Loading branch information
Showing
8 changed files
with
104 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ | |
ios::IStream<StreamExtension> os( streamer ); | ||
return os >> data; | ||
} | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,55 @@ | ||
/******************************************************************************** Copyright 2015 Christopher Andrews. https://github.com/Chris--A/PrintEx Released under MIT licence.********************************************************************************/ #include "MemoryPrinter.h" /******************************************************************************** EEPROMPrinter class ********************************************************************************/#ifdef __AVR__ size_t EEPROMPrinter::write( uint8_t u_Data ) { if( eeprom_read_byte( start + len ) != u_Data ) eeprom_write_byte( start + len, u_Data ); ++len; return 0x01; } size_t EEPROMPrinter::printTo(Print& p) const { for( uint16_t counter = 0 ; counter < len ; ++counter ){ p.write( ( uint8_t ) eeprom_read_byte( &start[counter] ) ); } return len; }#endif /******************************************************************************** SRAMPrinter class ********************************************************************************/ size_t SRAMPrinter::write( uint8_t data ) { start[len++] = data; return 0x01; } /******************************************************************************** PROGMEMPrinter class ********************************************************************************/#ifdef __AVR__ size_t PROGMEMPrinter::printTo(Print& p) const { size_t returnSize = 0; for( uint16_t counter = 0 ;; ++counter ){ unsigned char current = pgm_read_byte( &start[counter] ); if ( !current ) break; returnSize += p.write( current ); } return returnSize; }#endif | ||
/******************************************************************************** | ||
Copyright 2015 Christopher Andrews. | ||
https://github.com/Chris--A/PrintEx | ||
Released under MIT licence. | ||
********************************************************************************/ | ||
|
||
#include "MemoryPrinter.h" | ||
|
||
|
||
/******************************************************************************** | ||
EEPROMPrinter class | ||
********************************************************************************/ | ||
#ifdef __AVR__ | ||
size_t EEPROMPrinter::write( uint8_t u_Data ) | ||
{ | ||
if( eeprom_read_byte( start + len ) != u_Data ) | ||
eeprom_write_byte( start + len, u_Data ); | ||
++len; | ||
return 0x01; | ||
} | ||
|
||
size_t EEPROMPrinter::printTo(Print& p) const | ||
{ | ||
for( uint16_t counter = 0 ; counter < len ; ++counter ){ | ||
p.write( ( uint8_t ) eeprom_read_byte( &start[counter] ) ); | ||
} | ||
return len; | ||
} | ||
#endif | ||
/******************************************************************************** | ||
SRAMPrinter class | ||
********************************************************************************/ | ||
|
||
size_t SRAMPrinter::write( uint8_t data ) | ||
{ | ||
start[len++] = data; | ||
return 0x01; | ||
} | ||
|
||
/******************************************************************************** | ||
PROGMEMPrinter class | ||
********************************************************************************/ | ||
#ifdef __AVR__ | ||
size_t PROGMEMPrinter::printTo(Print& p) const | ||
{ | ||
size_t returnSize = 0; | ||
for( uint16_t counter = 0 ;; ++counter ){ | ||
unsigned char current = pgm_read_byte( &start[counter] ); | ||
if ( !current ) break; | ||
returnSize += p.write( current ); | ||
} | ||
return returnSize; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,7 @@ | |
return os << data; | ||
} | ||
}; | ||
#endif | ||
}; //namespace ios | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
const pft p_Return = printer._printf( format, vList ); | ||
va_end( vList ); | ||
return p_Return; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters