Configure a TI Board

Configure a ti board to integrate a Texas Instruments TDA4VM into your machine:

Navigate to the CONFIGURE tab of your machine’s page in the Viam app. Click the + icon next to your machine part in the left-hand menu and select Component. Select the board type, then select the ti model. Enter a name or use the suggested name for your board and click Create.

An example configuration for a ti board in the Viam app Config Builder.

{
  "components": [
    {
      "name": "<your-ti-board>",
      "model": "ti",
      "type": "board",
      "namespace": "rdk",
      "attributes": {
        "digital_interrupts": [
          {
            "name": "<your-digital-interrupt-name>",
            "pin": "<pin-number>"
          }
        ]
      },
      "depends_on": []
    }
  ]
}

The following attributes are available for ti boards:

NameTypeInclusionDescription
digital_interruptsobjectOptionalAny digital interrupts’s pin number and name. See configuration info.

Attribute configuration

Configuring these attributes on your board allows you to integrate digital interrupts into your machine.

digital_interrupts

Interrupts are a method of signaling precise state changes. Configuring digital interrupts to monitor GPIO pins on your board is useful when your application needs to know precisely when there is a change in GPIO value between high and low.

  • 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() to record the state change and notify any interested callbacks to “interrupt” the program.
  • Calling 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 following the Config Builder instructions, or by adding the following to your board’s JSON configuration:

On your board’s 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.

// "attributes": { ... ,
"digital_interrupts": [
  {
    "name": "<your-digital-interrupt-name>",
    "pin": "<pin-number>"
  }
]
{
  "components": [
    {
      "model": "pi",
      "name": "your-board",
      "type": "board",
      "attributes": {
        "digital_interrupts": [
          {
            "name": "your-interrupt-1",
            "pin": "15"
          },
          {
            "name": "your-interrupt-2",
            "pin": "16"
          }
        ]
      }
    }
  ]
}

The following properties are available for digital_interrupts:

NameTypeInclusionDescription
namestringRequiredYour name for the digital interrupt.
pinstringRequiredThe pin number of the board’s GPIO pin that you wish to configure the digital interrupt for.
typestringOptionalOnly applies to pi model boards.
  • basic: Recommended. Tracks interrupt count.
  • servo: For interrupts configured for a pin controlling a servo. Tracks pulse width value.

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.



Have questions, or want to meet other people working on robots? Join our Community Discord.

If you notice any issues with the documentation, feel free to file an issue or edit this file.