DL40 - I/O Module Firmware
The following is a reasonably extensive demo project which could potentially be quite useful. The firmware allows you to configure any or all the available pins on the DL40 as either input, output or interrupt pins.
From the mainboard you can use the managed driver to configure the module pins and then react to interrupts, read or write the state of the pin etc.
This sample demonstrates reading multibyte registers and handling interrupts raised via the DaisyLink protocol.
The interface to the module contains the following
DLIOModule - Managed driver used to communicate with the DL40 module(s)
IInputPin - Interface for working with input pins
IOutputPin - Interface for working with output pins
IInterruptPin - Interface for working with interrupt enabled pins
IPulseCounterPin - Interface for working with pins that count the pulses
IAnalogInputPin - Interface for working with analog inputs (thanks to contribution from jernejk)
IPWMOutputPin - Interface for working with PWM outputs
There is support for two types of pulse counter pins
- Pulse Counter which uses interrupts to count pin pulses - Peaks around 150kHz (150,000 pulses per second)
- Capture Counter which uses the timer capture - Limited to 4 specific pins but has a peak of over 12Mhz (12,000,000 pulses per second)
Interrupt and pulse counter pins currently support interrupting/counting on the following states
Note: Capture pins only support Edge Low and Edge High
Input and Interrupt pins can have their pull-up/pull-down resistors configured. See the usage example.
I have not yet implemented glitch filtering. I will be adding these shortly.
The zip package includes a pre-compiled binary of the DL40 firmware for this sample.