ch.hei.kart
Class KartSetup

java.lang.Object
  extended by ch.hei.kart.KartSetup

public class KartSetup
extends java.lang.Object

Groups all kart settings together and allows fancy Kart setup using returning reference listening and setter chaining techniques.

Author:
Michael Clausen (clm@hevs.ch)

Method Summary
 KartSetup clearHwSetting(KartHardwareSettings setting)
          Clears the given hardware setting flag.
 int drivePwmPeriod()
          Returns the drive motor control block PWM period.
 KartSetup drivePwmPeriod(int period)
          Sets the drive motor control block PWM period.
 java.util.EnumSet<KartHardwareSettings> hardwareSettings()
          Returns the Kart's actual hardware settings.
 KartSetup setHwSetting(KartHardwareSettings setting)
          Sets the given hardware setting flag.
 int steeringEndSwitchAddress()
          Returns the steering end switch address from which emulated end switch the data is considered by the steering FSM.
 KartSetup steeringEndSwitchAddress(int address)
          Sets the steering end switch address from which emulated end switch the data is considered by the steering FSM.
 int steeringMaxPosition()
          Returns the maximal step count at the opposite site of the stepper end contact switch.
 KartSetup steeringMaxPosition(int position)
          Sets the maximal step count of the steering motor.
 int steeringStepPeriod()
          Returns the steering motor driver step period.
 KartSetup steeringStepPeriod(int period)
          Sets the steering motor driver step period.
 float updateInterval()
          Returns the update interval of the Kart in seconds.
 KartSetup updateInterval(float interval)
          Sets the update interval of the Kart in seconds.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

drivePwmPeriod

public int drivePwmPeriod()
Returns the drive motor control block PWM period. The period is defined as the value the main FPGA clock is divided by.

Returns:
PWM period.

drivePwmPeriod

public KartSetup drivePwmPeriod(int period)
Sets the drive motor control block PWM period. The period is defined as the value the main FPGA clock is divided by. Defaults to 64.

Parameters:
period - PWM period.
Returns:
Reference to itself in order to chain the setters.

steeringMaxPosition

public int steeringMaxPosition()
Returns the maximal step count at the opposite site of the stepper end contact switch.

Returns:
Maximal stepper motor step count.

steeringMaxPosition

public KartSetup steeringMaxPosition(int position)
Sets the maximal step count of the steering motor. Default value is defined by Kart VHDL design.

Parameters:
position - The value of the step counter at the opposite site of the end switch.
Returns:
Reference to itself in order to chain the setters.

steeringStepPeriod

public int steeringStepPeriod()
Returns the steering motor driver step period. The period is defined as the value the main FPGA clock is divided by.

Returns:
Steering motor step period.

steeringStepPeriod

public KartSetup steeringStepPeriod(int period)
Sets the steering motor driver step period. The period is defined as the value the main FPGA clock is divided by. Defaults to 256.

Parameters:
period - Steering motor step period.
Returns:
Reference to itself in order to chain the setters.

steeringEndSwitchAddress

public int steeringEndSwitchAddress()
Returns the steering end switch address from which emulated end switch the data is considered by the steering FSM. This value can be ignored if the option to enable the emulated end contact is not set in the hardware settings.

Returns:
Steering end contact address.

steeringEndSwitchAddress

public KartSetup steeringEndSwitchAddress(int address)
Sets the steering end switch address from which emulated end switch the data is considered by the steering FSM. This value will be ignored if the option to enable the emulated end contact is not set in the hardware settings. Defaults to 0.

Parameters:
address - Steering end contact address.
Returns:
Reference to itself in order to chain the setters.

hardwareSettings

public java.util.EnumSet<KartHardwareSettings> hardwareSettings()
Returns the Kart's actual hardware settings. Default is all flags cleared.

Returns:
Kart's hardware settings.

setHwSetting

public KartSetup setHwSetting(KartHardwareSettings setting)
Sets the given hardware setting flag.

Parameters:
setting - Hardware setting flag to set.
Returns:
Reference to itself in order to chain the setters.

clearHwSetting

public KartSetup clearHwSetting(KartHardwareSettings setting)
Clears the given hardware setting flag.

Parameters:
setting - Hardware setting flag to clear.
Returns:
Reference to itself in order to chain the setters.

updateInterval

public float updateInterval()
Returns the update interval of the Kart in seconds. This interval is the time between each register update send from the Kart to the Android application.

Returns:
Update interval in seconds.

updateInterval

public KartSetup updateInterval(float interval)
Sets the update interval of the Kart in seconds. This interval is the time between each register update send from the Kart to the Android application. Note that fractions of seconds is supported too. Defaults to 0.064.

Parameters:
interval - Update interval in seconds.
Returns: