add: version.h
fix: refactor
This commit is contained in:
parent
532750da74
commit
f5f9be803c
36 changed files with 27 additions and 34 deletions
src/runners
35
src/runners/test.c
Normal file
35
src/runners/test.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
#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(uint_fast8_t i = 0; i < controller->relay_count; ++i)
|
||||
{
|
||||
for(int test_run = 2; test_run >= 0; --test_run)
|
||||
{
|
||||
int is_active = test_run % 2;
|
||||
if(global_config.relay_configs[i].inverted)
|
||||
{
|
||||
is_active = !is_active;
|
||||
}
|
||||
switch(global_config.relay_configs[i].driver)
|
||||
{
|
||||
case RELAY_DRIVER_GPIO:
|
||||
driver_gpio_set(global_config.relay_configs[i].pin, is_active);
|
||||
break;
|
||||
case RELAY_DRIVER_PIFACE:
|
||||
driver_piface_set(global_config.relay_configs[i].pin, is_active);
|
||||
break;
|
||||
default:
|
||||
LOG_WARN("relay %d is not using a driver\n", i);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue