How Can I Use API Software and Host Adapter GPIOs with a Touch IC?

Question from the Customer:

I have a project that includes the Touch IC of a touch-screen tablet. Looking at your online store, the Aardvark I2C/SPI Host Adapter and the Aardvark Software API look promising. Many of the tools that you provide seem to focus on EEPROMs. Many of the operations to apply to a Touch IC will be similar, but I will need other features, such as touch interrupts and other interactions. Are other API examples available? If not, how easy is it to create what I need?

Response from Technical Support:

Thanks for your question! Each API example can be used as is or modified for your specifications. In addition, each API example consists of independent “sub-functions” that can be used to create new applications. We will provide an on overview about using the API in the following sections.

Examples of API Programs

Following is a list of the examples of Aardvark API that could be useful for your project. Some of these functions operate with Accessory Boards that are often used for prototyping, as well as testing and troubleshooting API programs.

  • aadetect: Detect Aardvark host adapters that are attached to the system.
  • aalights: Flash LEDs that are attached to a Philips PCA9554D I/O port expander as found on the I2C/SPI Activity Board.
  • aai2c_eeprom: Read from or write to an I2C serial EEPROM, such as the Atmel AT24C02 on the I2C/SPI Activity Board.
  • aaspi_eeprom: Read from or write to an SPI serial EEPROM, such as the Atmel AT25080A found on the I2C/SPI Activity Board.
  • aai2c_file, aai2c_slave: Demonstrate the I2C slave functionality of the Aardvark device. This example requires two Aardvark host adapters.
  1. Run aai2c_slave with the first Aardvark host adapter to wait for a new slave transmission.
  2. In another shell, run aai2c_file to transmit a binary file with the second Aardvark host adapter.
  • aaspi_file, aaspi_slave: Demonstrate the SPI slave functionality of the Aardvark host adapter. This example requires two Aardvark host adapters that will be managed in two separate shells.
    1. Run aaspi_slave with the first Aardvark host adapter to wait for a new slave transmission.
    2. In another shell, run aaspi_file to transmit a binary file with the second Aardvark host adapter.
  • aagpio: Perform simple GPIO tests with a single Aardvark host adapter. The results can be verified using an oscilloscope or a multi-meter.

Getting Started with GPIO Features

To become more familiar with the GPIO features of the Aardvark I2C/SPI Host Adapter, the Aardvark Software API, and the Control Center Serial Software, we recommend the following quick start:

  1. Install the Control Center Serial Software.
  2. Make sure the Aardvark adapter is not connected to your target device.
  3. Connect the Aardvark adapter to the computer and open the Control Center Serial Software.
  4. Using the Control Center Serial Software GUI, connect to the Aardvark adapter and select the GPIO only mode.
    1. Ensure the I2C Pull-ups are disabled in the Aardvark menu.
  5. Set all the directions to OUT and set all the outputs to logical 0. Using a meter, verify that all the pins output 0V.
  6. Set all the outputs to logical 1, and verify that the pin outputs 3.3V.
  7. Do similar testing with the input pins, such as send a 3.3V or 0V signal to each input, then verify that the Aardvark host adapter detects the signals correctly.

Sending Interrupts via GPIO

You can use the GPIO feature of the Aardvark I2C/SPI Host Adapter to send interrupts. In our Knowledge Base, we provide an example of using API commands to send interrupts to the host computer. For details, please refer to the article Using the Aardvark I2C/SPI Host Adapter GPIO Feature to Support Interrupts. For details about the Aardvark host adapter signal pins, please refer to the section Hardware Specifications of the Aardvark I2C/SPI Host Adapter User Manual.

Configuring the Aardvark I2C/SPI Host Adapter

When using API, you often need to configure the Aardvark I2C/SPI Host Adapter. To do so, use aa_configure() . This “sub-function” is applied in many API examples.

def aa_configure (aardvark, config):
"""usage: int return = aa_configure(Aardvark aardvark, AardvarkConfig config)"""
if not AA_LIBRARY_LOADED: return AA_INCOMPATIBLE_LIBRARY
# Call API function
return api.py_aa_configure(aardvark, config)

Placing Libraries for a Correct Build

Here is a hint for “getting it right” the first time. Each executable\binary file depends on some libraries of the solution. Set up correctly, everything builds upon each other in the first build. To ensure the final build can address the libraries, copy all of the dependent dll files into the executable bin folder.

We hope this answers your questions. Additional resources that you may find helpful include the following:

If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.

Request a Demo