class PiDriver::Utils::Byte
Constants
- ALL_BITS_HIGH
- ALL_BITS_LOW
- NUM_BITS_PER_BYTE
- VALID_BYTES
Public Class Methods
bits_to_byte(bits)
click to toggle source
# File lib/pi_driver/utils/byte.rb, line 14 def self.bits_to_byte(bits) bits.join.to_i(2) end
byte_to_bits(byte)
click to toggle source
# File lib/pi_driver/utils/byte.rb, line 10 def self.byte_to_bits(byte) byte.to_s(2).rjust(NUM_BITS_PER_BYTE, '0').chars.map(&:to_i) end