Class: HackRF::Internals::SPIFlash
- Inherits:
-
Object
- Object
- HackRF::Internals::SPIFlash
- Defined in:
- lib/hackrf/internals.rb
Instance Method Summary collapse
- #erase! ⇒ Object
-
#initialize(device) ⇒ SPIFlash
constructor
A new instance of SPIFlash.
- #read(address, length) ⇒ Object
- #write(address, data) ⇒ Object
Constructor Details
#initialize(device) ⇒ SPIFlash
Returns a new instance of SPIFlash.
71 72 73 |
# File 'lib/hackrf/internals.rb', line 71 def initialize(device) @device = device end |
Instance Method Details
#erase! ⇒ Object
75 76 77 |
# File 'lib/hackrf/internals.rb', line 75 def erase! HackRF.hackrf_spiflash_erase(@device) end |
#read(address, length) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/hackrf/internals.rb', line 83 def read(address,length) buffer = FFI::Buffer.new(:uchar,length) HackRF.hackrf_spiflash_read(@device,address,buffer,length) return buffer.read_bytes(length) end |
#write(address, data) ⇒ Object
79 80 81 |
# File 'lib/hackrf/internals.rb', line 79 def write(address,data) HackRF.hackrf_spiflash_write(@device,address,data.bytes.length,data) end |