Class Registers

extends Registers
Registers for an I2C device.

Class summary


constructor device_/Device
Deprecated. Use Device.registers.

Constructors

Deprecated. Use Device.registers.

Methods

dump --from/any=128 --to/any=256 --width/any=8 -> none
Prints register values.
Prints registers starting at the given from until the given to (exclusive) as hexadecimal digits.
The width indicates the amount of bytes per line.

operator == other/any -> bool
Whether this object is equal to the other.
By default, identical is used for equality.
Inheritance
Classes overwrite this operator to get an equality specific to their needs. Equality operators often compare the type and field contents. For example:

class Pin:
  number/int

  constructor .number:

  operator == other:
    if other is not Pin: return false
    return number == other.number
A class doesn't have to follow the above format, but it must keep the operator in sync with any hash-code method. That is, if a class has a hash-code member, then the equality and hash-code must agree. If two instances are equal (a == b), then their hash codes must also be equal (a.hash-code == b.hash-code).

See super.

read-bytes reg/any count/any [failure] -> ByteArray
Calls the failure block in case of an exception.
Deprecated. Use exception handling instead.

read-i16-be register/int -> int
Reads a signed 16-bit integer from the register.
Uses big endian.

read-i16-le register/int -> int
Reads a signed 16-bit integer from the register.
Uses little endian.

read-i24-be register/int -> int
Reads a signed 24-bit integer from the register.
Uses big endian.

read-i24-le register/int -> int
Reads a signed 24-bit integer from the register.
Uses little endian.

read-i32-be register/int -> int
Reads a signed 32-bit integer from the register.
Uses big endian.

read-i32-le register/int -> int
Reads a signed 32-bit integer from the register.
Uses little endian.

read-i8 register/int -> int
Reads a signed 8-bit integer from the register.

read-u16-be register/int -> int
Reads an unsigned 16-bit integer from the register.
Uses big endian.

read-u16-be register/int [failure] -> int
Reads an unsigned 16-bit integer from the register.
Uses little endian.
Calls the failure block in case of an exception.
Deprecated. Use exception handling instead.

read-u16-le register/int -> int
Reads an unsigned 16-bit integer from the register.
Uses little endian.

read-u24-be register/int -> int
Reads an unsigned 24-bit integer from the register.
Uses big endian.

read-u24-le register/int -> int
Reads an unsigned 24-bit integer from the register.
Uses little endian.

read-u32-be register/int -> int
Reads an unsigned 32-bit integer from the register.
Uses big endian.

read-u32-le register/int -> int
Reads an unsigned 32-bit integer from the register.
Uses little endian.

read-u8 register/int -> int
Reads an unsigned 8-bit integer from the register.

Stringifies this object.
Inheritance
Objects that need a human-friendly string representation should overwrite this method. The default string is based on the internal class-ID.

write-32-le register/int value/int -> none
Writes the value to the given register as a signed 32-bit integer.
Uses little endian.

write-bytes reg/int bytes/ByteArray -> none
See super.

write-i16-be register/int value/int -> none
Writes the value to the given register as a signed 16-bit integer.
Uses big endian.

write-i16-le register/int value/int -> none
Writes the value to the given register as a signed 16-bit integer.
Uses little endian.

write-i24-be register/int value/int -> none
Writes the value to the given register as a signed 24-bit integer.
Uses big endian.

write-i24-le register/int value/int -> none
Writes the value to the given register as a signed 24-bit integer.
Uses little endian.

write-i32-be register/int value/int -> none
Writes the value to the given register as an unsigned 32-bit integer.
Uses big endian.

write-i8 register/int value/int -> none
Writes the value to the given register as a signed 8-bit integer.

write-u16-be register/int value/int -> none
Writes the value to the given register as an unsigned 16-bit integer.
Uses big endian.

write-u16-le register/int value/int -> none
Writes the value to the given register as an unsigned 16-bit integer.
Uses little endian.

write-u24-be register/int value/int -> none
Writes the value to the given register as an unsigned 24-bit integer.
Uses big endian.

write-u24-le register/int value/int -> none
Writes the value to the given register as an unsigned 24-bit integer.
Uses little endian.

write-u32-le register/int value/int -> none
Writes the value to the given register as an unsigned 32-bit integer.
Uses little endian.

write-u8 register/int value/int -> none
Writes the value to the given register as an unsigned 8-bit integer.