avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Help with flash lookup table


From: Micah Carrick
Subject: Re: [avr-gcc-list] Help with flash lookup table
Date: Wed, 10 May 2006 12:52:21 -0700
User-agent: Thunderbird 1.5.0.2 (X11/20060501)

Duh.  Great thanks... your suggestion worked:

return pgm_read_byte(&gp2d120_data[adc_value]);


Paulo Marques wrote:
Micah Carrick wrote:
[...]
uint8_t gp2d120_adc8_to_cm (uint8_t adc_value)
{
       uint8_t *ptr = gp2d120_data;
       *ptr += adc_value;
    ^^^^

this should be:

    ptr += adc_value;


Or even easier (totally untested):

uint8_t gp2d120_adc8_to_cm (uint8_t adc_value)
{
    return pgm_read_byte(&gp2d120_data[value]);
}

I hope this helps,






reply via email to

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