add button stuff and timer stuff

This commit is contained in:
Wolfgang Hottgenroth
2016-09-08 14:05:57 +02:00
parent 7c854e7353
commit 8e08c2045e
13 changed files with 238 additions and 26 deletions

View File

@ -0,0 +1,44 @@
/*
* testTask.c
*
* Created on: 29.08.2016
* Author: wn
*/
#include "gpio.h"
#include "testTask.h"
#include "PontCoopScheduler.h"
void testTaskInit(void *handleArg, tPin pin) {
tTestTaskHandle *handle = handleArg;
handle->pin = pin;
handle->toggle = 0;
}
void testTaskSwitchOff(void *handleArg) {
tTestTaskHandle *handle = handleArg;
if (handle->toggle == 0) {
handle->toggle = 1;
gpioSetPin(handle->pin, HIGH);
} else {
handle->toggle = 0;
gpioSetPin(handle->pin, LOW);
}
}
void testTaskExec(void *handleArg) {
tTestTaskHandle *handle = handleArg;
if (handle->toggle == 0) {
handle->toggle = 1;
gpioSetPin(handle->pin, HIGH);
} else {
handle->toggle = 0;
gpioSetPin(handle->pin, LOW);
}
schAdd(testTaskSwitchOff, handle, 5, 0);
}

View File

@ -0,0 +1,24 @@
/*
* testTask.h
*
* Created on: 29.08.2016
* Author: wn
*/
#ifndef TESTTASK_H_
#define TESTTASK_H_
#include "gpio.h"
typedef struct {
tPin pin;
uint8_t toggle;
} tTestTaskHandle;
void testTaskInit(void *handleArg, tPin pin);
void testTaskExec(void *handleArg);
#endif /* TESTTASK_H_ */