#include <stdio.h> #include <stdint.h>
#define pgm8(A) (*( uint8_t __flash * )(&(A))) #define pgm16(A) (*( uint16_t __flash*)(&(A))) #define pgm32(A) (*(uint32_t __flash*)(&(A)))
#define pgm_item(A) ((TItem * )&(A))
class TItem { public: uint8_t size; uint8_t * str; TItem * child; TItem * parent; uint8_t get_size(); uint8_t * get_str(); TItem * get_child(); TItem * get_parent(); void sub(void); };
uint8_t TItem::get_size() { return pgm8(this->size); }
uint8_t * TItem::get_str() { return (uint8_t *)pgm16(this->str); }
__flash TItem Item0; __flash TItem Item1; __flash TItem Item3={0xaa,(uint8_t *)"ABCDEFG",pgm_item(Item0),pgm_item(Item1)};
uint8_t size; uint8_t * str; TItem * child; TItem * parent;
int main() { size=pgm_item(Item3)->get_size(); str=pgm_item(Item3)->get_str();
while(1); } |