C# Класс CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider

A GPIO provider for servos driven via ServoBlaster. This is an implementation of Implementation of https://github.com/richardghirst/PiBits/tree/master/ServoBlaster
Наследование: IServoProvider
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
PIN_MAP String>.Dictionary
REVERSE_PIN_MAP IRaspiGpio>.Dictionary

Открытые методы

Метод Описание
Dispose ( ) : void

Releases all resource used by the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider object.

Call Dispose when you are finished using the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider. The Dispose method leaves the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider was occupying.

GetServoDriver ( IPin servoPin ) : IServoDriver

Gets a driver for the requested pin.

UpdateServo ( String pinName, Int32 value ) : void

Updates the servo by writing the specified value to the specified pin.

Защищенные методы

Метод Описание
EnsureWriterIsCreated ( ) : void

Ensures the writer is created.

OnUnrecognizedPinFound ( UnrecognizedPinFoundEventArgs e ) : void

Raises the unrecognized pin found event.

Приватные методы

Метод Описание
DefinePin ( IRaspiGpio pin, String name ) : void

Helper method for adding pins to the pin maps.

GetServoPinsFromConfig ( ) : List

Gets a list of servo pins from the config and validates them against the pin map.

RPIServoBlasterProvider ( ) : System

Initializes the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider class. This is a static initializer to populate the pin maps (which are also static). This initializer will only be called *ONCE* before any static members are referenced and will not be called again during the lifetime of the application domain. As such, it is NOT advisable to dispose of the pin maps (clear the dictionaries and/or set null) unless you know what you are doing as they are only initialized once.

Описание методов

Dispose() публичный Метод

Releases all resource used by the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider object.
Call Dispose when you are finished using the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider. The Dispose method leaves the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Components.Servos.RPIServoBlasterProvider was occupying.
public Dispose ( ) : void
Результат void

EnsureWriterIsCreated() защищенный Метод

Ensures the writer is created.
protected EnsureWriterIsCreated ( ) : void
Результат void

GetServoDriver() публичный Метод

Gets a driver for the requested pin.
/// The specified servo pin is not a defined servo pin. /// /// No driver is assigned to the specified pin - or - Cannot drive servo /// from specified pin - or - another initialization error occurred. ///
public GetServoDriver ( IPin servoPin ) : IServoDriver
servoPin IPin /// The pin the driver is needed for. ///
Результат IServoDriver

OnUnrecognizedPinFound() защищенный Метод

Raises the unrecognized pin found event.
protected OnUnrecognizedPinFound ( UnrecognizedPinFoundEventArgs e ) : void
e CyrusBuilt.MonoPi.IO.UnrecognizedPinFoundEventArgs /// The event arguments. ///
Результат void

UpdateServo() публичный Метод

Updates the servo by writing the specified value to the specified pin.
/// Unable to write to the ServoBlaster device. ///
public UpdateServo ( String pinName, Int32 value ) : void
pinName String /// The name of the pin to write to. ///
value System.Int32 /// The value to write to the pin. ///
Результат void

Описание свойств

PIN_MAP публичное статическое свойство

A pin map. Maps pin GPIO pins to pin names.
public static Dictionary PIN_MAP
Результат String>.Dictionary

REVERSE_PIN_MAP публичное статическое свойство

A reverse-order pin map. Maps pin names to GPIO pins.
public static Dictionary REVERSE_PIN_MAP
Результат IRaspiGpio>.Dictionary