controller-legacy/runners/test.c
Tobias Reisinger ec720e7617 add: vendor directory
add: cli (argparse)
add: test runner
2020-04-18 01:24:36 +02:00

30 lines
876 B
C

#include <unistd.h>
#include <runners.h>
#include <logger.h>
#include <drivers.h>
#include <drivers.h>
void
runner_test(controller_t *controller)
{
// from x down to 0 to turn all relays off in the end
for(int test_run = 2; test_run >= 0; --test_run)
{
for(uint_fast8_t i = 0; i < controller->relay_count; ++i)
{
switch(global_config.relay_configs[i].driver)
{
case RELAY_DRIVER_GPIO:
driver_gpio_set(global_config.relay_configs[i].pin, test_run % 2);
break;
case RELAY_DRIVER_PIFACE:
driver_piface_set(global_config.relay_configs[i].pin, test_run % 2);
break;
default:
LOG_WARN("relay %d is not using a driver", i);
}
sleep(1);
}
}
}