Update per bunni feedback

This commit is contained in:
Derek Jamison 2023-07-01 08:45:06 -05:00
parent a0eff12f17
commit d536cf1101
2 changed files with 11 additions and 11 deletions

View File

@ -1,10 +1,10 @@
# GPIO_BLINK
This is the classic "Hello World" of GPIO, where we blink an LED. You will need an LED (any color is fine) and a resistor (220 ohms - 1K should be fine). Connect the long side of the LED into pin A7. Connect the short size of the LED to one side of the resistor (doesn't matter which side). Connect the other side of the resistor to any of the pin GND.
This is the classic "Hello World" of GPIO, where we blink an LED. You will need an LED (any color is fine) and a resistor (220 ohms - 1 kiliohm should be fine). Connect the long side of the LED into pin A7. Connect the short size of the LED to one side of the resistor (doesn't matter which side). Connect the other side of the resistor to any of the pin GND.
Run the application and the LED should start blinking. Hold the back button to exit.
## How it works
- For list of pins see \firmware\targets\f18\furi_hal\furi_hal_resources.c
- For list of pins see [/firmware/targets/f7/furi_hal/furi_hal_resources.c](https://github.com/flipperdevices/flipperzero-firmware/blob/dev/firmware/targets/f7/furi_hal/furi_hal_resources.c) in your firmware repo.
- We define a variable for our LED...
```c
@ -12,13 +12,13 @@ Run the application and the LED should start blinking. Hold the back button to
```
- We initialize the pin for output.
- GpioModeOutputPushPull means true = +3.3V, false = 0V.
- GpioModeOutputOpenDrain means true = floating, false = 0V.
- ``GpioModeOutputPushPull`` means true = 3.3 volts, false = 0 volts.
- ``GpioModeOutputOpenDrain`` means true = floating, false = 0 volts.
```c
furi_hal_gpio_init_simple(pin_led, GpioModeOutputOpenDrain);
```
- We turn the LED on (3v3 volts on the pin).
- We turn the LED on (3.3 volts on the pin).
```c
furi_hal_gpio_write(pin_led, true);
```
@ -28,7 +28,7 @@ Run the application and the LED should start blinking. Hold the back button to
furi_delay_ms(500);
```
- We turn the LED off (GND volts on the pin).
- We turn the LED off (0 volts on the pin).
```c
furi_hal_gpio_write(pin_led, false);
```

View File

@ -1,7 +1,7 @@
#include <furi.h>
#include <gui/gui.h>
// For list of pins see \firmware\targets\f18\furi_hal\furi_hal_resources.c
// For list of pins see https://github.com/flipperdevices/flipperzero-firmware/blob/dev/firmware/targets/f7/furi_hal/furi_hal_resources.c
const GpioPin* const pin_led = &gpio_ext_pa7;
const GpioPin* const pin_back = &gpio_button_back;
@ -26,8 +26,8 @@ int gpio_blink_app(void* p) {
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Initialize the LED pin as output.
// GpioModeOutputPushPull means true = +3.3V, false = 0V.
// GpioModeOutputOpenDrain means true = floating, false = 0V.
// GpioModeOutputPushPull means true = 3.3 volts, false = 0 volts.
// GpioModeOutputOpenDrain means true = floating, false = 0 volts.
furi_hal_gpio_init_simple(pin_led, GpioModeOutputOpenDrain);
do {
furi_hal_gpio_write(pin_led, true);