Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5290

SDK • `enum gpio_irq_level` value names

$
0
0
I'm going to set up a GPIO interrupt to detect when a button is pressed.

I was looking at the C SDK documentation, and it describes the scenarios for which an interrupt can be generated:
• Level High: the GPIO pin is a logical 1
• Level Low: the GPIO pin is a logical 0
• Edge High: the GPIO has transitioned from a logical 0 to a logical 1
• Edge Low: the GPIO has transitioned from a logical 1 to a logical 0
That makes sense to me. However, the names of the corresponding `enum` values are a little different:

Code:

enum gpio_irq_level {    GPIO_IRQ_LEVEL_LOW = 0x1u,  ///< IRQ when the GPIO pin is a logical 1    GPIO_IRQ_LEVEL_HIGH = 0x2u, ///< IRQ when the GPIO pin is a logical 0    GPIO_IRQ_EDGE_FALL = 0x4u,  ///< IRQ when the GPIO has transitioned from a logical 0 to a logical 1    GPIO_IRQ_EDGE_RISE = 0x8u,  ///< IRQ when the GPIO has transitioned from a logical 1 to a logical 0};
Doesn't it seem like the labels "fall" and "rise" are reversed?

I ask because the only example I've found so far uses both "fall" and "rise" together. Thought I'd ask before playing with it.

Statistics: Posted by MathMonkeyMan — Wed Sep 11, 2024 3:41 pm — Replies 0 — Views 38



Viewing all articles
Browse latest Browse all 5290

Trending Articles