add: pulse mode

add: editorconfig
This commit is contained in:
Tobias Reisinger 2020-06-27 18:27:49 +02:00
parent 679175f1a9
commit 0f342b4aa8
13 changed files with 151 additions and 70 deletions
src/helpers

View file

@ -81,7 +81,10 @@ helper_load_config(IniDispatch *disp, void *config_void)
config->relay_configs = malloc(sizeof(config_relay_t) * config->relay_count);
for(uint8_t i = 0; i < config->relay_count; ++i)
{
config->relay_configs[i].driver= RELAY_DRIVER_NONE;
config->relay_configs[i].driver = RELAY_DRIVER_NONE;
config->relay_configs[i].inverted = 0;
config->relay_configs[i].pin = 0;
config->relay_configs[i].pulse_duration = 0;
}
LOG_TRACE("config relay-count set to %u\n", config->relay_count);
return 0;
@ -99,6 +102,11 @@ helper_load_config(IniDispatch *disp, void *config_void)
config->relay_configs[i].inverted = atoi(disp->value);
return 0;
}
if(CONFINI_IS_KEY(relay_section_name, "pulse-duration"))
{
config->relay_configs[i].pulse_duration = atoi(disp->value);
return 0;
}
if(CONFINI_IS_KEY(relay_section_name, "driver"))
{
if(strcasecmp(disp->value, "gpio") == 0)