-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlinux_gpios.orogen
85 lines (63 loc) · 2.83 KB
/
linux_gpios.orogen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# frozen_string_literal: true
name "linux_gpios"
using_library "base-logging", typekit: false
import_types_from "std"
import_types_from "raw_io"
import_types_from "linux_gpiosTypes.hpp"
# Task that reads and/or writes GPIOs
task_context "Task" do
# This is the default from now on, and should not be removed. Rock will
# transition to a setup where all components use a configuration step.
needs_configuration
# Root of GPIOs in sysfs. Exclusively for testing
property "sysfs_gpio_path", "/std/string", "/sys/class/gpio"
# Whether the output should be written only when change
#
# It is false to keep backward compatibility. We recommend setting to true
property "edge_triggered_output", "/bool", false
# The set of GPIOs that should be written, as a list of GPIO IDs
property "w_configuration", "/linux_gpios/WriteConfiguration"
# The port on which the 'output' GPIOs can be commanded, in the same order
# than the 'inputs' property
input_port "w_commands", "/linux_gpios/GPIOState"
# The set of GPIOs that should be read, as a list of GPIO IDs
property "r_configuration", "/linux_gpios/ReadConfiguration"
# The port on which the state of the GPIOs that are read is exported
#
# If edge_triggered_output is set to false, this port will periodically
# publish the GPIO state. If edge_triggered_output is set, the component
# will publish the state when it changes and when the w_states port is
# written. This latter condition allows to wait for a GPIO state to change,
# regardless of the curent state of the GPIO
#
# - create reader and writer
# - write state until it is reported as being the expected new state
output_port "r_states", "/linux_gpios/GPIOState"
periodic 0.01
exception_states :IO_ERROR, :UNEXPECTED_COMMAND_SIZE
end
task_context "TimerGPIOTask" do
needs_configuration
# The "ON" state to be sent to the GPIO
property "set_state", "/bool", true
# How long the GPIO should be maintained in the "set_state" state
property "duration", "/base/Time"
# How oft should report when the command will finish
property "deadline_report", "/base/Time"
# How long the task will accept not receiving a feedback from the GPIO
# during its execution
#
# Will cause the task to stop in an exception state, trying to turn the GPIO off
property "feedback_timeout", "/base/Time"
# How long the task will wait for a state transition to be confirmed
#
# This applies on start and stop transitions
property "switch_timeout", "/base/Time"
# GPIO feedback input
input_port "feedback", "/linux_gpios/GPIOState"
# Controlled GPIO output
output_port "gpio_state", "/linux_gpios/GPIOState"
# Deadline to complete the command
output_port "deadline", "base/Time"
periodic 0.01
end