Skip to content

Commit fc6947a

Browse files
committed
fix: Integrate LED1 init into callback step.
1 parent 578f804 commit fc6947a

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

doc/guides/c_tutorials/gpio.mdx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ that way we can drastically reduce the power consumption of the device.
181181
First we need to define the callback function
182182
that will be called when the button is pressed.
183183

184-
```c title="Define the LED1 pin and mode"
185-
/* Define the LED1 pin and mode */
186-
gpio_t led1 = GPIO_PIN(1, 10);
187-
gpio_mode_t led1_mode = GPIO_OUT;
188-
```
189-
190184
```c title="Define the button callback function"
191185
/* This callback function will be called when the button state changes */
192186
void button_callback(void *arg) {
@@ -202,9 +196,13 @@ void button_callback(void *arg) {
202196
}
203197
```
204198
205-
Now we need to define the button pin and mode and initialize it.
199+
Now we need to define the button and led1 pin and mode and initialize it.
200+
201+
```c {1-6, 27-33}
202+
/* Define the LED1 pin and mode */
203+
gpio_t led1 = GPIO_PIN(1, 10);
204+
gpio_mode_t led1_mode = GPIO_OUT;
206205
207-
```c {1-2, 26-27}
208206
/* Define the button pin */
209207
gpio_t button = GPIO_PIN(1, 2);
210208

0 commit comments

Comments
 (0)