Update per bunni feedback
This commit is contained in:
parent
a0eff12f17
commit
d536cf1101
@ -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,28 +12,28 @@ 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);
|
||||
```
|
||||
|
||||
- We wait 500ms.
|
||||
- We wait 500 ms.
|
||||
```c
|
||||
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);
|
||||
```
|
||||
|
||||
- We wait 500ms.
|
||||
- We wait 500 ms.
|
||||
```c
|
||||
furi_delay_ms(500);
|
||||
```
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user