Tables must be const in order to be put into read-only section by means of __attribute__((progmem)) (avr-gcc 4.7.0)

ico
Cristiano De Alti 2014-11-29 15:40:31 +01:00
parent abac0f0381
commit 65e70baa84
2 changed files with 11 additions and 10 deletions

View File

@ -132,11 +132,11 @@ beep(void)
static uint8_t tuneindex=0;
static uint8_t pictures[] PROGMEM = {G4,4, F4,4, AS4,4, C5,2, F5,2, D5,4, C5,2, F5,2, D5,4, AS4,4, C5,4, G4,4, F4,4, 0xff};
static uint8_t axel[] PROGMEM = {FS4,2, NONE,2, A4,3, FS4,2, FS4,1, B4,2, FS4,2, E4,2, FS4,2, NONE,2, CS5,3, FS4,2, FS4,1, D5,2, CS5,2, A4,2, FS4,2, CS5,2, FS5,2, FS4,1, E4,2, E4,1, CS4,2, GS4,2, FS4,6, 0xff};
static uint8_t sandman1[] PROGMEM = {F4,2, G4,2, B4,4, A4,10, B4,2, B4,2, A4,2, B4,12, 0xff};
static uint8_t sandman2[] PROGMEM = {C4,2, E4,2, G4,2, B4,2, A4,2, G4,2, E4,2, C4,2, D4,2, F4,2, A4,2, C5,2, B4,8, 0xff};
static uint8_t furelise[] PROGMEM = {E5,1, DS5,1, E5,1, DS5,1, E5,1, B4,1, D5,1, E5,1, A4,2, NONE,1, C4,1, E4,1, A4,1, B4,2, NONE,1, E4,1, GS4,1, B4,1, C5,2, 0xff};
static const uint8_t pictures[] PROGMEM = {G4,4, F4,4, AS4,4, C5,2, F5,2, D5,4, C5,2, F5,2, D5,4, AS4,4, C5,4, G4,4, F4,4, 0xff};
static const uint8_t axel[] PROGMEM = {FS4,2, NONE,2, A4,3, FS4,2, FS4,1, B4,2, FS4,2, E4,2, FS4,2, NONE,2, CS5,3, FS4,2, FS4,1, D5,2, CS5,2, A4,2, FS4,2, CS5,2, FS5,2, FS4,1, E4,2, E4,1, CS4,2, GS4,2, FS4,6, 0xff};
static const uint8_t sandman1[] PROGMEM = {F4,2, G4,2, B4,4, A4,10, B4,2, B4,2, A4,2, B4,12, 0xff};
static const uint8_t sandman2[] PROGMEM = {C4,2, E4,2, G4,2, B4,2, A4,2, G4,2, E4,2, C4,2, D4,2, F4,2, A4,2, C5,2, B4,8, 0xff};
static const uint8_t furelise[] PROGMEM = {E5,1, DS5,1, E5,1, DS5,1, E5,1, B4,1, D5,1, E5,1, A4,2, NONE,1, C4,1, E4,1, A4,1, B4,2, NONE,1, E4,1, GS4,1, B4,1, C5,2, 0xff};
static volatile uint8_t icnt,tone;
@ -153,7 +153,8 @@ ISR(TIMER0_OVF_vect)
void play_ringtone(void)
{
uint8_t i,*noteptr;
uint8_t i;
const uint8_t *noteptr;
/* What's next on the playlist? */
switch (tuneindex++) {

View File

@ -58,7 +58,7 @@ static uint16_t temp_table_celcius[];
static uint16_t temp_table_fahrenheit[];
#else /* !DOXYGEN */
/** Celcius temperatures (ADC-value) from -15 to 60 degrees */
static uint16_t temp_table_celcius[] PROGMEM = {
static const uint16_t temp_table_celcius[] PROGMEM = {
923,917,911,904,898,891,883,876,868,860,851,843,834,825,815,
806,796,786,775,765,754,743,732,720,709,697,685,673,661,649,
636,624,611,599,586,574,562,549,537,524,512,500,488,476,464,
@ -68,7 +68,7 @@ static uint16_t temp_table_celcius[] PROGMEM = {
};
/** Fahrenheit temperatures (ADC-value) from 0 to 140 degrees */
static uint16_t temp_table_fahrenheit[] PROGMEM = {
static const uint16_t temp_table_fahrenheit[] PROGMEM = {
938, 935, 932, 929, 926, 923, 920, 916, 913, 909, 906, 902, 898,
894, 891, 887, 882, 878, 874, 870, 865, 861, 856, 851, 847, 842,
837, 832, 827, 822, 816, 811, 806, 800, 795, 789, 783, 778, 772,
@ -99,7 +99,7 @@ bool temp_initialized = false;
*
* \return EOF on error
*/
static int find_temp(int16_t value, uint16_t* array, int count);
static int find_temp(int16_t value, const uint16_t* array, int count);
/*---------------------------------------------------------------------------*/
@ -232,7 +232,7 @@ temp_get(temp_unit_t unit)
* \return EOF on error
*/
static int
find_temp(int16_t value, uint16_t* array, int count)
find_temp(int16_t value, const uint16_t* array, int count)
{
int i = 0;
int table_val = 0;