gpio_registerForInterrupt

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Please add documentation for thi aPI, especially around the MASK parameter.

void gpio_registerForInterrupt(UINT16 masks[],

                               void (*userfn)(void*, UINT8),

                                 void* userdata);

0 Likes
1 Solution
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

The masks parameter has to be an array of 3 UINT16s, each corresponding to the three ports on the 2073x (port0 which has P0-P15, port1 which has P16-P31 and port2 which has P32-P39). The interrupt handler you register here will be invoked for interrupts that trigger for the bits that are set in the mask parameter.

For instance, if you want handler1 to handle interrupts on P0, P4, P24 and P33:

UINT16 masks1[3] = {    (1)  | (1 << 4),     (1 << 8),   (1 << 1)  };

gpio_registerForInterrupt(masks1, handler1, NULL);

And handler2 to handle interrupts on P1 and P4:

UINT16 masks2[3] = {  (1 << 1) | ( 1<< 4 ), 0, 0 };

gpio_registerForInterrupt(masks2, handler2, NULL);

View solution in original post

1 Reply
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

The masks parameter has to be an array of 3 UINT16s, each corresponding to the three ports on the 2073x (port0 which has P0-P15, port1 which has P16-P31 and port2 which has P32-P39). The interrupt handler you register here will be invoked for interrupts that trigger for the bits that are set in the mask parameter.

For instance, if you want handler1 to handle interrupts on P0, P4, P24 and P33:

UINT16 masks1[3] = {    (1)  | (1 << 4),     (1 << 8),   (1 << 1)  };

gpio_registerForInterrupt(masks1, handler1, NULL);

And handler2 to handle interrupts on P1 and P4:

UINT16 masks2[3] = {  (1 << 1) | ( 1<< 4 ), 0, 0 };

gpio_registerForInterrupt(masks2, handler2, NULL);