Hi,
My C is a bit rusty... I have a working program, but when I make my array's bigger it just fails in random ways, I'm guessing the arrays are filling the SRAM, so I want to move them to flash.
I have :
typedef struct _point {int x,y;} point;
struct _point pointsTarget[]={
{0x01,0x01},{0x01,0x40},{0x01,0x80},{0x01,0xC0},{0x01,0xFF},{0x40,0xFF},{0x80,0xFF},
{0xC0,0xFF},{0xFF,0xFF},{0xFF,0xC0},{0xFF,0x80},{0xFF,0x40},{0xFF,0x01},{0xC0,0x01},
{0x80,0x01},{0x40,0x01},{0x01,0x01},{0x40,0x40},{0x80,0x80},{0xC0,0xC0},{0xFF,0xFF},
{0x00,0x00},{0xFF,0x01},{0xC0,0x40},{0x80,0x80},{0x40,0xC0},{0x01,0xFF},{0x00,0x00}
};
void DrawFrame (struct _point * pShape, int nArraySize, int nScale, int nAngle, int nDelay) {
for (p=0; p<nArraySize; p++){
x = pShape[p].x;
y = pShape[p].y;
//more code ...
}
}
I know I have to add PROGMEM to my array def, but them I'm a bit lost where to put the pgm_read_byte macros with a type def ?
Can someone help me with the syntax ?
A couple of the arrays are large...
Thanks.
Jon.