Skip to content

Commit

Permalink
Remove prog_char, for compliance with gcc 4.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
maniacbug committed Jan 18, 2012
1 parent 205d4b5 commit f6e59b9
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 144 deletions.
4 changes: 2 additions & 2 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void RF24::print_observe_tx(uint8_t value)

/****************************************************************************/

void RF24::print_byte_register(prog_char* name, uint8_t reg, uint8_t qty)
void RF24::print_byte_register(const char* name, uint8_t reg, uint8_t qty)
{
char extra_tab = strlen_P(name) < 8 ? '\t' : 0;
printf_P(PSTR(PRIPSTR"\t%c ="),name,extra_tab);
Expand All @@ -217,7 +217,7 @@ void RF24::print_byte_register(prog_char* name, uint8_t reg, uint8_t qty)

/****************************************************************************/

void RF24::print_address_register(prog_char* name, uint8_t reg, uint8_t qty)
void RF24::print_address_register(const char* name, uint8_t reg, uint8_t qty)
{
char extra_tab = strlen_P(name) < 8 ? '\t' : 0;
printf_P(PSTR(PRIPSTR"\t%c ="),name,extra_tab);
Expand Down
4 changes: 2 additions & 2 deletions RF24.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class RF24
* @param reg Which register. Use constants from nRF24L01.h
* @param qty How many successive registers to print
*/
void print_byte_register(prog_char* name, uint8_t reg, uint8_t qty = 1);
void print_byte_register(const char* name, uint8_t reg, uint8_t qty = 1);

/**
* Print the name and value of a 40-bit address register to stdout
Expand All @@ -207,7 +207,7 @@ class RF24
* @param reg Which register. Use constants from nRF24L01.h
* @param qty How many successive registers to print
*/
void print_address_register(prog_char* name, uint8_t reg, uint8_t qty = 1);
void print_address_register(const char* name, uint8_t reg, uint8_t qty = 1);

/**
* Turn on or off the special features of the chip
Expand Down
6 changes: 4 additions & 2 deletions RF24_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@ extern HardwareSPI SPI;
#endif

// Avoid spurious warnings
#if 1
#if ! defined( NATIVE ) && defined( ARDUINO )
#undef PROGMEM
#define PROGMEM __attribute__(( section(".progmem.data") ))
#undef PSTR
#define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];}))
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
#endif
#endif

// Progmem is Arduino-specific
#ifdef ARDUINO
#include <avr/pgmspace.h>
#define PRIPSTR "%S"
#else
typedef char const prog_char;
typedef char const char;
typedef uint16_t prog_uint16_t;
#define PSTR(x) (x)
#define printf_P printf
Expand Down
Loading

0 comments on commit f6e59b9

Please sign in to comment.