Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Archive of legacy Student Robotics git repository 'boards/interconnect-fw.git'

Notifications You must be signed in to change notification settings

srobo-legacy/boards-interconnect-fw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The token passing code works something like the following:

TO = HT = 0;
pause(2);
while(1) {
    if(TI) {           // Got the token
        if(RT) {       // Do we want to use the token
            HT = 1;
            while(RT); // Wait until finished using the token
            HT = 0;
        }
        while(TI);     // Wait for the whole of the token to arrive
        TO = 1;
        pause(TOKEN_LENGTH);  // Send the token on its way
        TO = 0;
    }
}

The token generator, for debugging purposes, works like:

GenerateToken  // Input, active low
RemoveToken    // Input, active low
pause(2);
while(1) {
    if(!GenerateToken) {          // Should generate a new token
        pause(10m);               // Debouncing
        while(!GenerateToken);    // Only send it when button is released
        TO = 1;
		  pause(TOKEN_LENGTH);
		  TO = 0;
    }
    if (TI) {                     // Normal token handling (passing on)
        while(TI);
        if (RemoveToken) {        // Don't pass token on if it's to be removed
            TO = 1;
            pause(TOKEN_LENGTH);
            TO = 0;
        }
    }
}

About

Archive of legacy Student Robotics git repository 'boards/interconnect-fw.git'

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published