Class: Denko::Sensor::VL53L0X
- Inherits:
-
Object
- Object
- Denko::Sensor::VL53L0X
- Defined in:
- lib/denko/sensor/vl53l0x.rb
Constant Summary collapse
- I2C_ADDRESS =
0x29- REFERENCE_REGISTER_START =
0xC0- REFERENCE_VALUES =
[0xEE, 0xAA, 0x10]
- SYSRANGE_START =
0x00- POWER_MANAGEMENT_GO1_POWER_FORCE =
0x80- INTERNAL_TUNING_1 =
0x91- INTERNAL_TUNING_2 =
0xFF- RESULT_RANGE_STATUS =
0x14
Constants included from Behaviors::Lifecycle
Behaviors::Lifecycle::CALLBACK_METHODS
Constants included from Behaviors::Reader
Behaviors::Reader::READ_WAIT_TIME
Constants included from I2C::Peripheral
I2C::Peripheral::I2C_FREQUENCY, I2C::Peripheral::I2C_REPEATED_START
Instance Attribute Summary collapse
-
#correction_offset ⇒ Object
Returns the value of attribute correction_offset.
-
#stop_variable ⇒ Object
readonly
Returns the value of attribute stop_variable.
Attributes included from AnalogIO::InputHelper
Attributes included from Behaviors::Threaded
Attributes included from Behaviors::State
Attributes included from I2C::Peripheral
#i2c_frequency, #i2c_repeated_start
Attributes included from Behaviors::Component
Instance Method Summary collapse
Methods included from AnalogIO::InputHelper
#on_change, #smooth_input, #smoothing_set
Methods included from Behaviors::Lifecycle
Methods included from Behaviors::Poller
Methods included from Behaviors::Threaded
#enable_interrupts, included, #mruby_thread_check, #stop, #stop_thread, #threaded, #threaded_loop
Methods included from Behaviors::Reader
#read, #read_busy?, #read_nb, #read_raw, #read_using, #update
Methods included from Behaviors::Callbacks
#add_callback, #callbacks, #remove_callback, #update
Methods included from Behaviors::State
Methods included from I2C::Peripheral
#address, #i2c_default, #i2c_read, #i2c_read_raw, #i2c_write
Methods included from Behaviors::BusPeripheralAddressed
Methods included from Behaviors::BusPeripheral
Methods included from Behaviors::Component
Instance Attribute Details
#correction_offset ⇒ Object
Returns the value of attribute correction_offset.
21 22 23 |
# File 'lib/denko/sensor/vl53l0x.rb', line 21 def correction_offset @correction_offset end |
#stop_variable ⇒ Object (readonly)
Returns the value of attribute stop_variable.
20 21 22 |
# File 'lib/denko/sensor/vl53l0x.rb', line 20 def stop_variable @stop_variable end |
Instance Method Details
#_read ⇒ Object
45 46 47 |
# File 'lib/denko/sensor/vl53l0x.rb', line 45 def _read i2c_read(2, register: RESULT_RANGE_STATUS + 10) end |
#pre_callback_filter(bytes) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/denko/sensor/vl53l0x.rb', line 49 def pre_callback_filter(bytes) # Distance is 2 bytes, big-endian. mm = (bytes[0] << 8) | bytes[1] mm = mm + correction_offset if correction_offset # super handles smoothing if enabled. return (mm > 0) ? super(mm) : nil end |