Code for an autonomous plane I'm building. Includes process scheduling, process communication, and hardware sensor interfacing (via I2C). NOTE: currently in development, source code will be updated frequently.

Dependencies:   mbed

control.h

Committer:
teamgoat
Date:
2013-11-02
Revision:
4:44a5b1e8fd27
Parent:
2:452dd766d212

File content as of revision 4:44a5b1e8fd27:

#ifndef CONTROL_H
#define CONTROL_H

#define OUTPUT_SIZE 512
#define MAX_SID_LEN 32

char* get_output(int);
void init();
void schedule();
int schedule_proc(char *sid, int (*funcptr)(int));

typedef enum
{
    READY,
    BLOCKED,
    ZOMBIE,
    EMPTY
} proc_stat;

typedef struct
{
    // process status
    unsigned int status;
    // if status == BLOCKED, wait till block_pid's status is ZOMBIE
    unsigned int block_pid;
    // function. each "process" is a function with a number of properties and storage space
    int (*start)(int);
    char sid[MAX_SID_LEN];
    char output[OUTPUT_SIZE];
} process;

#endif //CONTROL_H