Class: Pigpio::BitBangSerial

Inherits:
BitBangSerialTx show all
Defined in:
lib/pigpio/bit_bang_serial.rb

Instance Attribute Summary collapse

Attributes inherited from BitBangSerialTx

#tx

Instance Method Summary collapse

Methods inherited from BitBangSerialTx

#busy?, #stop, #sync, #write, #write_sync

Constructor Details

#initialize(rx, tx, baud = 9600, data_bits = 8, stop_bits = 1, parity_type = :none) ⇒ BitBangSerial

Returns a new instance of BitBangSerial.



7
8
9
10
# File 'lib/pigpio/bit_bang_serial.rb', line 7

def initialize(rx, tx, baud = 9600, data_bits = 8, stop_bits = 1, parity_type = :none)
  super(tx, baud, data_bits, stop_bits)
  @rx = BitBangSerialRx.new(rx, baud, data_bits)
end

Instance Attribute Details

#rxObject (readonly)

Returns the value of attribute rx.



6
7
8
# File 'lib/pigpio/bit_bang_serial.rb', line 6

def rx
  @rx
end

Instance Method Details

#closeObject



12
13
14
15
# File 'lib/pigpio/bit_bang_serial.rb', line 12

def close
  super
  @rx.close
end

#read(bufsize = 1) ⇒ Object



17
18
19
# File 'lib/pigpio/bit_bang_serial.rb', line 17

def read(bufsize = 1)
  @rx.read(bufsize)
end