Search by Tags

How to use Interrupt library

 
Applicable for

Compare with Revision




Subscribe for this article updates

Overview

The interrupt library is used for interrupt handling capabilities of Toradex module.

Use cases:

  • Proximity card reader on Wiegand interface
  • SD card insertion detection
  • Switch status on change
  • and many more..

Interrupt Library

We provide free [IntLib] including demo source code.

Download Demo projects

Project Module compatibility Language Library Version
Demo PXA / Tegra C Toradex CE Library (Old)
Demo VFxx / iMX6 C Toradex CE Library (New)
Demo PXA / Tegra C# Toradex CE Library (Old)
Demo VFxx / iMX6 C# Toradex CE Library (New)

Note: With Toradex New library version ToradexCeLibraries_V1_6_3123, VC sharp functions for interrupt library are not imported, so only for this demo we have updated TdxAllLibraries.cs to include class Int which will have all function imported for interrupt library from TdxAllLibraries.dll.

Hardware setup

The setup on the Colibri Evaluation Board V3.1A can be seen here.


This application demonstrates the use of Interrupt library by capturing an interrupt at GPIO pin (SODIMM_101) and blinking an LED every time an interrupt is captured.

Procedure

The sequential process followed in the demo is:

  1. Set SODIMM_101 (connected to SW5) and SODIMM_135 (connected to LED1) as GPIO input and GPIO output respectively.
  2. Get Interrupt number for GPIO number (for SODIMM_101).
  3. Configure interrupt to detect rising edge.
  4. Create an event or check for an existing event for which the system will wait.
  5. Get the corresponding System Interrupt number for the Interrupt number obtained in step 2.
  6. Link the event created in step 4 with System Interrupt obtained in step 5.
  7. If the event occurs, the system asks if it should continue waiting. On choosing "Yes" it changes the status of LED (ON or OFF).
  8. Else on choosing "No", interrupt is de-initialized.

Demo application in C

  • Build and deploy the solution.
  • Go to My Device > Program Files > interrupt_demo and run the application.

Following image shows the output window of the application:


Demo application in CSharp

  • Navigate to Solution Explorer in visual studio > Right Click on Solution > Properties > Devices.
  • Uncheck "Deploy the Latest version of the .NET Compact Framework (including Service Packs)".
  • Build and deploy the project on your WinCE device.
  • Download and Install .NET Compact Framework directly to the FlashDisk of the device from here.
  • Go to My Device > Program Files > vcsharp_interrupt_demo and run the application.

Following GUI will open: