[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] How define a function pointer array in programmemory?
From: |
whiteman |
Subject: |
Re: [avr-gcc-list] How define a function pointer array in programmemory? |
Date: |
Wed, 25 Feb 2004 8:35:24 +0800 |
Christian Ludlam!
thanks for your reply. my source is ok!! thanks again.
======= 2004-02-23 10:39:00 =======
>On 23 Feb Artur Lipowski wrote:
>
>> Try this:
>> typedef void (*FPtr)(void);
>> FPtr Key_Protab[] = { keypro1, keypro2, keypro3 };
>>
>> and call:
>> Key_Protab[functionID]();
>>
>> BTW> Your question has nothing in common to AVR-GCC, answer can be found
>> reading any book about a C language.
>
>It is specific to AVR-GCC, because the question was how to put such a table
>in program memory. In that case you need to
>
> typedef void (*FPtr)(void);
> FPtr Key_Protab[] PROGMEM = { keypro1, keypro2, keypro3 };
>
>and to call,
>
> FPtr ptr = (FPtr) pgm_read_word(&Key_Protab[functionID]);
> ptr();
>
>--
>Christian Ludlam
>address@hidden
>
>_______________________________________________
>avr-gcc-list mailing list
>address@hidden
>http://www.avr1.org/mailman/listinfo/avr-gcc-list
= = = = = = = = = = = = = = = = = = = =
Regards
whiteman
address@hidden
2004-02-25
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [avr-gcc-list] How define a function pointer array in programmemory?,
whiteman <=