Skip to content

Commit

Permalink
DOCS-1720: Include digital interrupts config and control (#2650)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyleilani authored Mar 13, 2024
1 parent fde93f4 commit 1f94ccd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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)

0 comments on commit 1f94ccd

Please sign in to comment.