Combining some of the pin names generated by hal_input with the recipe for creating HAL devices, here’s a test configuration that hitches an old Nostromo N52 controller to a LinuxCNC system (clicky for more dots):

The F01 key lights the red LED, the Orange Button lights the green LED, and a oneshot timer pulses the blue LED for half a second after the Button closes. The Thread block defines the connections from the functions to the main timing routine, and the loadrt block defines the thread timing. The hal_input module takes care of its own input sampling in userspace.
Now, for the classic embedded system “Hello, world!” test:

It’s amazing how good an LED can make you feel…
A halscope shot shows the timing relation between the Orange Button (confusingly hitched to the greenkey signal) and the oneshot pulse:

That schematic produces this HAL configuration file:
# HAL config file automatically generated by Eagle-CAD ULP: # [/mnt/bulkdata/Project Files/eagle/ulp/hal-write-2.5.ulp] # (C) Martin Schoeneck.de 2008 # Charalampos Alexopoulos 2011 # Mods Ed Nisley KE4ZNU 2010 2013 # Path [/mnt/bulkdata/Project Files/eagle/projects/LinuxCNC HAL Configuration/] # ProjectName [Nostromo] # File name [/mnt/bulkdata/Project Files/eagle/projects/LinuxCNC HAL Configuration/Nostromo.hal] # Created [12:28:04 14-Feb-2013] #################################################### # Load realtime and userspace modules loadrt threads name1=test-thread period1=1000000 loadusr -W hal_input -K +Nostromo:0 -KRL +Nostromo:1 loadrt constant count=1 loadrt oneshot count=1 #################################################### # Hook functions into threads addf oneshot.0 test-thread addf constant.0 test-thread #################################################### # Set parameters #################################################### # Set constants setp constant.0.value 0.5 #################################################### # Connect Modules with nets net bluepulse input.1.led-scrolll oneshot.0.out net duration constant.0.out oneshot.0.width net greenkey input.0.key-leftalt oneshot.0.in input.1.led-capsl net redkey input.0.key-tab input.1.led-numl
A snapshot of the Nostromo.sch, Nostromo.hal, hal_config.lbr, and hal-write-2.5.ulp files is in Nostromo-N52.zip.odt. Rename it to get rid of the ODT suffix, unzip it, and there you go.