-
Notifications
You must be signed in to change notification settings - Fork 139
Raspberry.IO.GeneralPurpose.Configuration.GpioConnectionConfigurationSection
raspberry-sharp edited this page Oct 23, 2012
·
7 revisions
The GpioConnectionConfigurationSection
class implements a configuration section dedicated to configuration of GPIO access.
<section name="gpioConnection"
type="Raspberry.IO.GeneralPurpose.Configuration.GpioConnectionConfigurationSection, Raspberry.IO.GeneralPurpose" />
<gpioConnection
boardRevision="1|2|auto"
pollInterval="duration (ms)"
driver="type full name, assembly" />
-
boardRevision
: the revision of the board (1
or2
), orauto
to detect automatically the board revision. Default isauto
, -
pollInterval
: the poll interval for input pins, in milliseconds. Default value is 50ms. On Raspberry Pi, values may be lower than 1. For instance, a value of0.1
represents a 100µs interval. Values lower than 1 millisecond imply a heavy CPU load on Raspberry Pi, -
driver
: the fully qualified name of the IGpioConnectionDriver implementation. By default,MemoryGpioConnectionDriver
is used.
<configSections>
<section name="gpioConnection"
type="Raspberry.IO.GeneralPurpose.Configuration.GpioConnectionConfigurationSection, Raspberry.IO.GeneralPurpose" />
</configSections>
<gpioConnection
pollInterval="25"
driver="Raspberry.IO.GeneralPurpose.FileConnectionDriver, Raspberry.IO.GeneralPurpose" />
Value of driver
attribute of gpioConnection
section element is used by GpioConnection to load default configuration settings.
GpioConnectionConfigurationSection
may also be used as follow:
IConnectionDriver driver;
var configurationSection = ConfigurationManager.GetSection("gpioConnection") as GpioConnectionConfigurationSection;
if (configurationSection != null && !string.IsNullOrEmpty(configurationSection.DriverTypeName))
driver = (IConnectionDriver) Activator.CreateInstance(Type.GetType(configurationSection.DriverTypeName, true));
else
driver = new MemoryConnectionDriver();