diff options
author | Karel Kočí <cynerd@email.cz> | 2015-10-17 15:40:51 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-10-17 15:40:51 +0200 |
commit | b0d8f22f3492fbb3f6dc0e8026e63c803af59007 (patch) | |
tree | eb9707612e87856962474885f2a18ae1621d214e /tasks.h | |
parent | 8fa9db4244f4ee33aa47561c569edfa62fe37928 (diff) | |
download | avr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.tar.gz avr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.tar.bz2 avr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.zip |
Complete commit of current work
Diffstat (limited to 'tasks.h')
-rw-r--r-- | tasks.h | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +#include <avr/io.h> +#include <util/delay.h> +#include <avr/interrupt.h> +#include <stdint.h> + +#include "mcu/mcu_def.h" +#include "timer.h" + +#ifndef _IOE_TASKS_H_ +#define _IOE_TASKS_H_ +#ifdef CONFIG_IOE_TASKS + +#ifndef CONFIG_IOE_TIMERS +#error "To use tasks you must enable timers (CONFIG_IOE_TIMERS)." +#endif + +struct Task { + +}; + +void taskDelay(uint16_t us); +void taskDelayMS(uint16_t ms); +void taskDelayTill(int8_t *boolean); +int8_t taskDelayTillT(int8_t *boolean, uin16_t us); +void taskDelayTillF(int8_t (*fnc)(void)); +void taskDelayTillFT(int8_t (*fnc)(void), uint16_t us); + +#else /* CONFIG_IOE_TASKS */ + +#define taskDelay(US) _delay_us(US) +#define taskDelayTill(BOOL) while(*BOOL == 0) +int8_t taskDelayTillT(int8_t *condition, uint8_t timeout_10us); + +#endif /* CONFIG_IOE_TASKS */ +#endif /* _IOE_TASKS_H_ */ |