Module: ObjectOrientedBeagleboneBlack::PinMappings
- Included in:
- AnalogInput, Led
- Defined in:
- lib/object_oriented_beaglebone_black/pin_mappings.rb
Instance Method Summary collapse
Instance Method Details
#load_pin_index_array ⇒ Object
7 8 9 10 11 |
# File 'lib/object_oriented_beaglebone_black/pin_mappings.rb', line 7 def load_pin_index_array # In order not to use activesupport (since Beaglebone Black didn't have Internet access to download it previously), Hash#deep_symbolize_keys! is not used. # ::OBJECT_ORIENTED_BEAGLEBONE_BLACK_PIN_INDEX_ARRAY ||= JSON.load(File.read(File.join(OBJECT_ORIENTED_BEAGLEBONE_BLACK_ROOT, "config", "pin_index.json")))["pinIndex"].each { |property_hash| property_hash.deep_symbolize_keys! } ::OBJECT_ORIENTED_BEAGLEBONE_BLACK_PIN_INDEX_ARRAY ||= JSON.load(File.read(File.join(OBJECT_ORIENTED_BEAGLEBONE_BLACK_ROOT, "config", "pin_index.json")))["pinIndex"] end |
#property_hash(name: nil, key: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/object_oriented_beaglebone_black/pin_mappings.rb', line 13 def property_hash(name: nil, key: nil) load_pin_index_array if !name.nil? ::OBJECT_ORIENTED_BEAGLEBONE_BLACK_PIN_INDEX_ARRAY.find { |property_hash| property_hash["name"] == name } elsif !key.nil? ::OBJECT_ORIENTED_BEAGLEBONE_BLACK_PIN_INDEX_ARRAY.find { |property_hash| property_hash["key"] == key } end end |