Project

General

Profile

Revision 1544

I gave the scheduler a crack based on avrOS and the code
from 18348 that I think caused John to add these skeleton files.

Very very basic preemptive task scheduling that runs through the
list of tasks, checks if they are ready to run based on a timer period
(in processor cycles as it uses time.h) and launches them...
Just occurred to me that I should default to main, update in a few seconds.

I tend to spew bad code everywhere when I think something is cool
or useful so it almost definitey won't work. It still needs a
timer (I was thinking of stealing it from the real time clock),
but after that, in an ideal world it would work...

View differences:

scheduler.h
12 12
#ifndef _SCHEDULER_H_
13 13
#define _SCHEDULER_H_
14 14

  
15
#define STACKSIZE 64
16
#define MAXTASKS 16
15 17

  
18
#define PRIORITY_LOWEST 8
16 19

  
20
#include <stdint.h>
21

  
22
void scheduler_init(void);
23
void yield(void);
24
int register_task(void (*exec)(void), uint16_t period);
25

  
17 26
#endif

Also available in: Unified diff