GPIO Flag Magic Numbers in bleprofile.h

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

cross mob
Anonymous
Not applicable

In the WICED SMART SDK, under the include directory structure in bleprofile.h, starting on line 74, there are several #defines for GPIO flag bits.  The first section appears to define direction, initialization state, etc.  I can make sense of these.

// GPIO flag bit (this is different than definition that used in gpio driver source code (GPIO_INPUT_ENABLE, etc)

#define GPIO_NUM_MAX  16

#define GPIO_INPUT          0x0000

#define GPIO_OUTPUT         0x0001

#define GPIO_INIT_LOW       0x0000

#define GPIO_INIT_HIGH      0x0002

#define GPIO_POLL           0x0000

#define GPIO_INT            0x0004   // Interrupt

#define GPIO_BOTHEDGE_INT   0x0008   // Both Edge

Just under those, starting on line 82, there are another series of magic numbers.  Can anyone explain why the values are what they are?

#define GPIO_WP             0x0010   //EEPROM write protect

#define GPIO_BAT            0x0020

#define GPIO_BUTTON         0x0100

#define GPIO_BUTTON1        0x0100

#define GPIO_BUTTON2        0x0200

#define GPIO_BUTTON3        0x0400

#define GPIO_LED            0x1000

#define GPIO_BUZ            0x2000

Thank you,

-Troy

0 Likes
1 Solution
VikramR_26
Employee
Employee
25 sign-ins 10 sign-ins 10 comments on KBA

the magic numbers are for led buzzer button as labelled .. If you notice these are based on masking the bits 0,2,4,8 ..

View solution in original post

5 Replies