def to_code(config): for pin in gpio_output_pin_expression(config[CONF_PIN]): yield rhs = App.make_gpio_output(pin) gpio = Pvariable(config[CONF_ID], rhs) output.setup_output_platform(gpio, config) setup_component(gpio, config)
def to_code(config): power_supply = None if CONF_POWER_SUPPLY in config: for power_supply in get_variable(config[CONF_POWER_SUPPLY]): yield for pca9685 in get_variable(config[CONF_PCA9685_ID]): yield rhs = pca9685.create_channel(config[CONF_CHANNEL], power_supply) out = Pvariable(config[CONF_ID], rhs) output.setup_output_platform(out, config, skip_power_supply=True)
def to_code(config): frequency = config.get(CONF_FREQUENCY) if frequency is None and CONF_BIT_DEPTH in config: frequency = 1000 rhs = App.make_ledc_output(config[CONF_PIN], frequency, config.get(CONF_BIT_DEPTH)) ledc = Pvariable(config[CONF_ID], rhs) if CONF_CHANNEL in config: add(ledc.set_channel(config[CONF_CHANNEL])) output.setup_output_platform(ledc, config) setup_component(ledc, config)
def to_code(config): for pin in gpio_output_pin_expression(config[CONF_PIN]): yield rhs = App.make_esp8266_pwm_output(pin) gpio = Pvariable(config[CONF_ID], rhs) if CONF_FREQUENCY in config: add(gpio.set_frequency(config[CONF_FREQUENCY])) output.setup_output_platform(gpio, config) setup_component(gpio, config)
def to_code(config): power_supply = None if CONF_POWER_SUPPLY in config: for power_supply in get_variable(config[CONF_POWER_SUPPLY]): yield my9231 = None for my9231 in get_variable(config[CONF_MY9231_ID]): yield rhs = my9231.create_channel(config[CONF_CHANNEL], power_supply) out = Pvariable(config[CONF_ID], rhs) output.setup_output_platform(out, config, skip_power_supply=True) setup_component(out, config)
def to_code(config): outputs = [] for out in config[CONF_OUTPUTS]: for var in get_variable(out): yield outputs.append(var) klass = { 'binary': BinaryCopyOutput, 'float': FloatCopyOutput, }[config[CONF_TYPE]] rhs = klass.new(outputs) gpio = Pvariable(config[CONF_ID], rhs) output.setup_output_platform(gpio, config) setup_component(gpio, config)