Module: Denko::Behaviors::SinglePin
- Includes:
- Component
- Included in:
- InputPin, OutputPin, Connection::BinaryEcho, DigitalIO::CBitBang, LED::WS2812, Motor::Servo, PulseIO::IROutput, SPI::ChipSelect, UART::Hardware
- Defined in:
- lib/denko/behaviors/single_pin.rb
Constant Summary
Constants included from Lifecycle
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#pin ⇒ Object
readonly
Returns the value of attribute pin.
Attributes included from Component
Attributes included from State
Instance Method Summary collapse
Methods included from Component
Methods included from State
Methods included from Lifecycle
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
5 6 7 |
# File 'lib/denko/behaviors/single_pin.rb', line 5 def mode @mode end |
#pin ⇒ Object (readonly)
Returns the value of attribute pin.
5 6 7 |
# File 'lib/denko/behaviors/single_pin.rb', line 5 def pin @pin end |
Instance Method Details
#convert_pins(options = {}) ⇒ Object
12 13 14 15 |
# File 'lib/denko/behaviors/single_pin.rb', line 12 def convert_pins(={}) raise ArgumentError, 'a pin is required for this component' unless [:pin] [:pin] = board.convert_pin([:pin]) end |
#initialize_pins(options = {}) ⇒ Object
17 18 19 20 |
# File 'lib/denko/behaviors/single_pin.rb', line 17 def initialize_pins(={}) @pin = [:pin] self.mode = params[:mode] if params[:mode] end |