MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / gpio_led_get_state

Function gpio_led_get_state

components/drivers/led/led-gpio.c:61–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61static rt_err_t gpio_led_get_state(struct rt_led_device *led, enum rt_led_state *out_state)
62{
63 struct gpio_led *gled = raw_to_gpio_led(led);
64
65 switch (rt_pin_read(gled->pin))
66 {
67 case PIN_LOW:
68 *out_state = RT_LED_S_OFF;
69 break;
70
71 case PIN_HIGH:
72 *out_state = RT_LED_S_ON;
73 break;
74
75 default:
76 return -RT_ERROR;
77 }
78
79 return RT_EOK;
80}
81
82const static struct rt_led_ops gpio_led_ops =
83{

Callers

nothing calls this directly

Calls 1

rt_pin_readFunction · 0.50

Tested by

no test coverage detected