7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/rbuspirate/interfaces/abstract.rb', line 7
def configure_peripherals(
power: false, pullup: false, aux: false, cs: false
)
[power, pullup, aux, cs].map(&:class).each do |cls|
raise ArgumentError, 'All args must be true or false' unless [FalseClass, TrueClass].include?(cls)
end
bit_config = Commands::CONF_PER
bit_config |= Commands::Config::Peripherals::POWER if power
bit_config |= Commands::Config::Peripherals::PULLUP if pullup
bit_config |= Commands::Config::Peripherals::AUX if aux
bit_config |= Commands::Config::Peripherals::CS if cs
simplex_command(
bit_config,
Timeouts::SUCCESS,
'Unable to confgure peripherals'
)
@power, @pullup, @aux, @cs = power, pullup, aux, cs
end
|