Class: Msp430Bsl::Uart::Ack
- Inherits:
-
Object
- Object
- Msp430Bsl::Uart::Ack
- Defined in:
- lib/msp430_bsl/uart/ack.rb
Constant Summary collapse
- MESSAGES =
{ 0x00 => { code: :ack, reason: 'ACK - Command correctly received' }, 0x51 => { code: :header_nok, reason: 'Header incorrect. The packet did not begin with the required 0x80 value' }, 0x52 => { code: :crc_nok, reason: 'Checksum incorrect. The packet did not have the correct checksum value' }, 0x53 => { code: :packet_size_zero, reason: 'Packet size zero. The size for the BSL core command was given as 0' }, 0x54 => { code: :packet_size_exceeds, reason: 'Packet size exceeds buffer. The packet size given is too big for the RX buffer' }, 0x55 => { code: :unkown_error, reason: 'Unknown error' }, 0x56 => { code: :unkown_baudrate, reason: 'Unknown baud rate. The supplied data for baud rate change is not a known value' } }
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ Ack
constructor
A new instance of Ack.
- #ok? ⇒ Boolean
- #reason ⇒ Object
Constructor Details
#initialize(value) ⇒ Ack
Returns a new instance of Ack.
19 20 21 22 23 24 |
# File 'lib/msp430_bsl/uart/ack.rb', line 19 def initialize(value) raise Exceptions::Ack::MessageNotSupported, value unless MESSAGES.include?(value) @value = value @message = MESSAGES[@value] end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
17 18 19 |
# File 'lib/msp430_bsl/uart/ack.rb', line 17 def @message end |
#value ⇒ Object
Returns the value of attribute value.
17 18 19 |
# File 'lib/msp430_bsl/uart/ack.rb', line 17 def value @value end |
Instance Method Details
#ok? ⇒ Boolean
26 27 28 |
# File 'lib/msp430_bsl/uart/ack.rb', line 26 def ok? value == 0x00 end |
#reason ⇒ Object
30 31 32 |
# File 'lib/msp430_bsl/uart/ack.rb', line 30 def reason [:reason] end |