> typedef struct
> {
> struct
> {
> uint8 x:4;
> uint8 y:4;
> } v;
> char name[4];
> } PIN;
>
> PIN Pin[] PROGMEM =
> {
> { { 1, 2 }, "PC6" },
> { { 3, 4 }, "PD0" }
> };
>
> int main(void)
> {
> PIN local;
> uint8 a;
>
> memcpy_P(&local, &Pin[0], sizeof(PIN));
> a = local.v.x;
> memcpy_P(&local, &Pin[1], sizeof(PIN));
> a = local.v.y;
Many thanks for this suggestion. I didn't know that memcpy_P existed but I do
now. And I think initialising arrays will work for me as well since the names
are all 3 or 4 characters in length so the program memory wasted by declaring:
char name[5];
..will be more than compensated for by not storing 16-bit pointers to the
strings in program memory:
flash: 88 bytes
RAM: 0 bytes
- neil
_______________________________________________
AVR-chat mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-chat