Page 1 of 1

Array of Port/Pal objects

Posted: Sat Jul 23, 2016 9:45 am
by Tabulous
if i wanted to create an array of port pins what data types would i need to use i.e

what would x and y need to be, i'm abit unsure looking at the pal driver.

Code: Select all


typedef struct {
    x port;
   y pin;
}PINTBL_TypeDef;


static const PINTBL_TypeDef table[] =
{
   {   GPIOA,      GPIOA_PIN4,         },
   {   GPIOB,      GPIOB_PIN5,         },
};


usage :-

Code: Select all

PINTBL_TypeDef *p;


p = &table[i];
palReadPad(p->port, p->pin)

Re: Array of Port/Pal objects

Posted: Sat Jul 23, 2016 10:34 am
by Giovanni
Hi,

Use ioline_t, it represent both a port and a pin, no need to make that structure.

Giovanni