How to use Interrupt library
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 Project | VS2013 Project | VS2015 Project | Module compatibility | Language |
---|---|---|---|---|
Demo | - | - | PXA / Tegra | C |
Demo | Demo | Demo | Tegra / VFxx / iMX6 | C |
Demo | - | - | PXA / Tegra | C# |
Demo | - | - | VFxx / iMX6 | C# |
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.
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:
- Set SODIMM_101 (connected to SW5) and SODIMM_135 (connected to LED1) as GPIO input and GPIO output respectively.
- Get Interrupt number for GPIO number (for SODIMM_101).
- Configure interrupt to detect rising edge.
- Create an event or check for an existing event for which the system will wait.
- Get the corresponding System Interrupt number for the Interrupt number obtained in step 2.
- Link the event created in step 4 with System Interrupt obtained in step 5.
- If the event occurs, the system asks if it should continue waiting. On choosing "Yes" it changes the status of LED (ON or OFF).
- 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: