Class: Denko::Motor::Stepper
Instance Attribute Summary collapse
#pin, #pins, #proxies
#board
Instance Method Summary
collapse
#before_initialize, #convert_pins, #proxy_pin, #proxy_states, #require_pin, #require_pins
#initialize, #micro_delay
#initialize, #state
Instance Attribute Details
#microsteps ⇒ Object
Returns the value of attribute microsteps.
16
17
18
|
# File 'lib/denko/motor/stepper.rb', line 16
def microsteps
@microsteps
end
|
Instance Method Details
#after_initialize(options = {}) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/denko/motor/stepper.rb', line 18
def after_initialize(options={})
wake; on;
if (ms1 && ms2)
self.microsteps = 8
end
end
|
#initialize_pins(options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/denko/motor/stepper.rb', line 6
def initialize_pins(options={})
proxy_pin :step, DigitalIO::Output
proxy_pin :direction, DigitalIO::Output
proxy_pin :ms1, DigitalIO::Output, optional: true
proxy_pin :ms2, DigitalIO::Output, optional: true
proxy_pin :enable, DigitalIO::Output, optional: true
proxy_pin :slp, DigitalIO::Output, optional: true
end
|
#off ⇒ Object
34
35
36
|
# File 'lib/denko/motor/stepper.rb', line 34
def off
enable.high if enable
end
|
#on ⇒ Object
38
39
40
|
# File 'lib/denko/motor/stepper.rb', line 38
def on
enable.low if enable
end
|
#sleep ⇒ Object
26
27
28
|
# File 'lib/denko/motor/stepper.rb', line 26
def sleep
slp.low if slp
end
|
#step_cc ⇒ Object
Also known as:
step_ccw
56
57
58
59
60
|
# File 'lib/denko/motor/stepper.rb', line 56
def step_cc
direction.high unless direction.high?
step.high
step.low
end
|
#step_cw ⇒ Object
62
63
64
65
66
|
# File 'lib/denko/motor/stepper.rb', line 62
def step_cw
direction.low unless direction.low?
step.high
step.low
end
|
#wake ⇒ Object
30
31
32
|
# File 'lib/denko/motor/stepper.rb', line 30
def wake
slp.high if slp
end
|