Class SPIAccelerometerSim

    • Constructor Detail

      • SPIAccelerometerSim

        public SPIAccelerometerSim​(int index)
        Construct a new simulation object.
        Parameters:
        index - the HAL index of the accelerometer
    • Method Detail

      • registerActiveCallback

        public CallbackStore registerActiveCallback​(NotifyCallback callback,
                                                    boolean initialNotify)
        Register a callback to be run when this accelerometer activates.
        Parameters:
        callback - the callback
        initialNotify - whether to run the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getActive

        public boolean getActive()
        Check whether the accelerometer is active.
        Returns:
        true if active
      • setActive

        public void setActive​(boolean active)
        Define whether this accelerometer is active.
        Parameters:
        active - the new state
      • registerRangeCallback

        public CallbackStore registerRangeCallback​(NotifyCallback callback,
                                                   boolean initialNotify)
        Register a callback to be run whenever the range changes.
        Parameters:
        callback - the callback
        initialNotify - whether to call the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getRange

        public int getRange()
        Check the range of this accelerometer.
        Returns:
        the accelerometer range
      • setRange

        public void setRange​(int range)
        Change the range of this accelerometer.
        Parameters:
        range - the new accelerometer range
      • registerXCallback

        public CallbackStore registerXCallback​(NotifyCallback callback,
                                               boolean initialNotify)
        Register a callback to be run whenever the X axis value changes.
        Parameters:
        callback - the callback
        initialNotify - whether to call the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getX

        public double getX()
        Measure the X axis value.
        Returns:
        the X axis measurement
      • setX

        public void setX​(double x)
        Change the X axis value of the accelerometer.
        Parameters:
        x - the new reading of the X axis
      • registerYCallback

        public CallbackStore registerYCallback​(NotifyCallback callback,
                                               boolean initialNotify)
        Register a callback to be run whenever the Y axis value changes.
        Parameters:
        callback - the callback
        initialNotify - whether to call the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getY

        public double getY()
        Measure the Y axis value.
        Returns:
        the Y axis measurement
      • setY

        public void setY​(double y)
        Change the Y axis value of the accelerometer.
        Parameters:
        y - the new reading of the Y axis
      • registerZCallback

        public CallbackStore registerZCallback​(NotifyCallback callback,
                                               boolean initialNotify)
        Register a callback to be run whenever the Z axis value changes.
        Parameters:
        callback - the callback
        initialNotify - whether to call the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getZ

        public double getZ()
        Measure the Z axis value.
        Returns:
        the Z axis measurement
      • setZ

        public void setZ​(double z)
        Change the Z axis value of the accelerometer.
        Parameters:
        z - the new reading of the Z axis
      • resetData

        public void resetData()
        Reset all simulation data of this object.