Class: IntelHex::Record::ValueRecordUint16
- Inherits:
-
IntelHex::Record
- Object
- IntelHex::Record
- IntelHex::Record::ValueRecordUint16
- Defined in:
- lib/intel_hex/record/value_record_uint16.rb
Instance Attribute Summary
Attributes inherited from IntelHex::Record
#checksum, #data, #length, #line, #offset
Class Method Summary collapse
Instance Method Summary collapse
-
#value ⇒ Object
Retrieve the 16-bit unsigned integer value from the record.
-
#value=(value) ⇒ Object
Store a 32-bit unsigned integer value in the record.
Methods inherited from IntelHex::Record
#calculate_checksum, data, #each_byte_with_address, ela, eof, esa, inherited, #initialize, parse, #recalculate_checksum, register_type, sla, ssa, #to_ascii, #to_h, #to_s, #type_data_length, #type_id, type_id, #type_name, type_name, #valid?, #validate, #validate_checksum, #validate_data, #validate_length, #validate_offset, #value_s
Constructor Details
This class inherits a constructor from IntelHex::Record
Class Method Details
.type_data_length ⇒ Object
6 7 8 |
# File 'lib/intel_hex/record/value_record_uint16.rb', line 6 def self.type_data_length 2 end |
Instance Method Details
#value ⇒ Object
Retrieve the 16-bit unsigned integer value from the record.
11 12 13 |
# File 'lib/intel_hex/record/value_record_uint16.rb', line 11 def value (data[0] << 8) | data[1] end |
#value=(value) ⇒ Object
Store a 32-bit unsigned integer value in the record.
16 17 18 19 20 21 22 23 |
# File 'lib/intel_hex/record/value_record_uint16.rb', line 16 def value=(value) data[0..1] = [ (value & 0xff00) >> 8, value & 0x00ff, ] @length = data.size @checksum = recalculate_checksum end |