Skip to main content

How to use Interrupt library

danger

this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.


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

VS2008 ProjectVS2013 ProjectVS2015 ProjectModule compatibilityLanguage
Demo--PXA / TegraC
DemoDemoDemoTegra / VFxx / iMX6C
Demo--PXA / TegraC#
Demo--VFxx / iMX6C#
info

With Toradex New library version ToradexCeLibrariesV1_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.

info

It is always recommended to update the libraries first before compiling the demo project. Click on this link to get latest libraries.

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:



Send Feedback!