[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Pgmspace.h Use

From: Ron
Subject: RE: [avr-gcc-list] Pgmspace.h Use
Date: Wed, 10 Aug 2005 19:46:19 +1000

> const prog_char array[7] = {0x10,0x20,0x30,0x40,0x50,0x60,0x70};
> y = pgm_read_byte(&array[2]);
> // I would like to to keep the syntax y = array[2]; without 
> having the array copied in the SRAM
> Is there a way to do it ?

As Brano suggested, a macro is about as close as you can get. Not
_quite_ what you want, but close:

#define array(i)    pgm_read_byte(&Array[i])
const prog_char Array[7] = {0x10,0x20,0x30,0x40,0x50,0x60,0x70};

  y = array(4);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]