WKP pin number in E0

Hi, I am using an E0 of the Electron family.

I need to use WKP to wake up the device. From the datasheet of E0, WKP is defined as pin 19. However, the source code of deviceOS/1.4.4/firmware-1.4.4/hal/src/electron/pinmap_defines.h shows WKP as 17.

#define WKP 17

I am confused. Which pin number should I use?


Not to be rude, though it’s going to sound like it. In the time it took you to post the question, you could have just tried it.

Good comment. I did. It worked with pin 17. So, I am confused and want to know why.

Can you share your sleep/wake code here?

The physical pin numbers on the board (aka their location) are not to be confused with the internal pin mapping.
e.g. on the physical pin location 1 you’ll find Vin but this will not line up with any GPIO. On the other hand D1 has the logical pin number 1 to refer to it in code.
Or there is no physical pin location 0 but D0 has that logical pin number.

BTW, it’s recommended to use the pin names (e.g. WKP) in code rather than replacing these with anonymous numbers - that helps readability and portability.