Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Commit a146c7a

Browse files
05-gpios: add comments
1 parent 88b1410 commit a146c7a

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

05-gpios/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,18 @@ write particular registers that control the GPIO peripheral.
3030
#include "periph/gpio.h"
3131
```
3232

33-
**2. Inside the `main` function, initialize the LED0 GPIO pin as an output.**
33+
**2. Outside the `main` function define the LED0 GPIO pin as an output.**
3434
**In the `pba-d-01-kw2x` we are currently using, the LED0 is connected to the**
3535
**Port D, Pin 6:**
3636
```C
3737
gpio_t led0 = GPIO_PIN(PORT_D, 6);
3838
gpio_mode_t led0_mode = GPIO_OUT;
39-
40-
gpio_init(led0, led0_mode);
4139
```
4240

4341
**3. The LEDs on the board are on when the GPIO outputs `0`.**
44-
**Start by turning the LED off (setting the GPIO to `1`):**
42+
**Inside the `main` function, start by initializing the GPIO and turning the LED off (setting the GPIO to `1`):**
4543
```C
44+
gpio_init(led0, led0_mode);
4645
gpio_set(led0);
4746
```
4847
@@ -98,7 +97,7 @@ void button_callback (void *arg)
9897
/* define button outside the main function, as we will use it later */
9998
gpio_t button = GPIO_PIN(PORT_D, 1);
10099
101-
/* ... */
100+
/* initialize button inside the main function */
102101
gpio_init_int(button, GPIO_IN_PU, GPIO_BOTH, button_callback, NULL);
103102
```
104103

0 commit comments

Comments
 (0)