Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS-1720: Include digital interrupts config and control #2650

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion static/include/components/board/board-digital-interrupts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ Configuring digital interrupts to monitor GPIO pins on your board is useful when
- When an interrupt configured on your board processes a change in the state of the GPIO pin it is configured to monitor, it calls [`Tick()`](/components/board/#tick) to record the state change and notify any interested [callbacks](/components/board/#addcallback) to "interrupt" the program.
- Calling [`GetGPIO()`](/components/board/#getgpio) on a GPIO pin, which you can do without configuring interrupts, is useful when you want to know a pin's value at specific points in your program, but is less precise and convenient than using an interrupt.

Integrate `digital_interrupts` into your machine in the `attributes` of your board by adding the following to your board's JSON configuration:
Integrate `digital_interrupts` into your machine in the `attributes` of your board by following the **Config Builder** instructions, or by adding the following to your board's JSON configuration:

{{< tabs name="Configure a Digital Interrupt" >}}
{{% tab name="Config Builder" %}}

On your boards panel, click **Show more**, then select **Add digital interrupt**.
Assign a name to your digital interrupt and then enter a pin number.

![An example configuration for digital interrupts in the Viam app Config Builder.](/components/board/digital-interrupts-ui-config.png)

{{% /tab %}}
{{% tab name="JSON Template" %}}

```json {class="line-numbers linkable-line-numbers"}
Expand Down Expand Up @@ -57,3 +65,10 @@ The following properties are available for `digital_interrupts`:
|`name` | string | **Required** | Your name for the digital interrupt. |
|`pin`| string | **Required** | The {{< glossary_tooltip term_id="pin-number" text="pin number" >}} of the board's GPIO pin that you wish to configure the digital interrupt for. |
|`type`| string | Optional | _Only applies to `pi` model boards._ <ul><li>`basic`: Recommended. Tracks interrupt count. </li> <li>`servo`: For interrupts configured for a pin controlling a [servo](/components/servo/). Tracks pulse width value. </li></ul> |

#### Test `digital interrupts`

Once you have configured your digital interrupts, navigate to the **Control** tab to monitor interrupt activity.
The value displayed next to each interrupt name represent the total count of interrupts triggered by the corresponding digital interrupt.

![Digital interrupts in the control tab.](/components/board/digital-interrupts-control-tab.png)
Loading