#!/usr/bin/env python

PACKAGE='motor_driver'

from dynamic_reconfigure.parameter_generator_catkin import *
from driver_base.msg import SensorLevels

import motor_driver.constants as mdc

gen = ParameterGenerator()

GPIO_PIN_ENUM = mdc.get_gpio_pin_enum(gen)

gen.add("address", str_t, SensorLevels.RECONFIGURE_RUNNING, "My very own dynamic parameter.", '0x60' )
gen.add("invert", bool_t, SensorLevels.RECONFIGURE_RUNNING, "My very own dynamic parameter.", False )
gen.add("soft_disable", bool_t, SensorLevels.RECONFIGURE_RUNNING, "My very own dynamic parameter.", False )
gen.add("offset_voltage", double_t, SensorLevels.RECONFIGURE_RUNNING, "My very own dynamic parameter.", 0.0, -5.0, 5.0 )
gen.add("dummy_i2c", bool_t, SensorLevels.RECONFIGURE_RUNNING, "My very own dynamic parameter.", False )

gen.add( "dir_pin", int_t, SensorLevels.RECONFIGURE_RUNNING, "", 
         mdc.GPIO_PINS[0], min(mdc.GPIO_PINS), max(mdc.GPIO_PINS), edit_method=GPIO_PIN_ENUM)

################################################################################################################################
# Parameter Examples. Add your own parameters below
################################################################################################################################

# Valid types: bool_t, int_t, double_t, str_t

#          Name        Type   Reconfiguration level             Description                         Default Min Max
# TODO: Enum for dir pin
# gen.add("dir_pin", int_t, SensorLevels.RECONFIGURE_RUNNING, "My very own dynamic parameter.", 10,     0,  100 )

# Example enum:
# size_enum = gen.enum([ gen.const("Small", int_t, 0, "A small constant"),
#                   gen.const("Medium", int_t, 1, "A medium constant"),
#                   gen.const("Large", int_t, 2, "A large constant"),
#                   gen.const("ExtraLarge", int_t, 3, "An extra large constant") ],
#                   "An enum to set size")

# gen.add("size", int_t, 0, "A size parameter which is edited via an enum", 1, 0, 3, edit_method=size_enum)

################################################################################################################################
################################################################################################################################


exit(gen.generate(PACKAGE, "motor", "Motor"))
