Beispiel #1
0
void DisplayModeSelect() {
	// Print the mode select screen
	OledClearBuffer();
	OledSetCursor(0,0);
	OledPutString("Enter Interface");
	OledSetCursor(0,2);
	OledPutString("Button 1 = SPI");
	OledSetCursor(0,3);
	OledPutString("Button 2 = I2C");
	OledUpdate();
}
Beispiel #2
0
void DisplaySplashScreen() {
    // Print the splash screen before starting game
    OledClearBuffer();
    OledSetCursor(0,0);
    OledPutString("FC");
    OledSetCursor(3,1);
    OledPutString("Cerebot");
    OledSetCursor(2,2);
    OledPutString("Maze Puzzle");
    OledUpdate();
}
Beispiel #3
0
void printTime(int min, int sec) {
    char temp1[10];
    OledSetCursor(10, 10);
    sprintf(temp1, "%d:%02d", min, sec);
    OledClear();
    OledPutString(temp1);
}
Beispiel #4
0
//determines the trigger setting, rearranges a string so that the trigger is in the correct
//format and displays it.  Instead of the triggers stored as .2 to 2.8, they are stored as 2 to 28
void displayTrigger(int state)
{
    char triggerString[3] = "000";
    sprintf(triggerString, "%d", state);

    if (state > 9)
    {
        triggerString[2] = triggerString[1];
        triggerString[1] = '.';
    }
    else
    {
        triggerString[2] = triggerString[0];
        triggerString[1] = '.';
        triggerString[0] = '0';
    }

    OledSetCursor(0,2);
    OledPutString(triggerString);
    OledPutString("V trigger");
}
Beispiel #5
0
//determines the string to be displayed based on a state variable and displays it on the oled
void displayTime(int state)
{
    if (state == 0)
        {
            OledPutString("0.2 msec/div");
        }
        else if(state == 1)
        {
            OledPutString("0.5 msec/div");
        }
        else if(state == 2)
        {
            OledPutString("1 msec/div  ");
        }
        else if (state == 3)
        {
            OledPutString("2 msec/div  ");
        }
        else if (state == 4)
        {
            OledPutString("5 msec/div  ");
        }
}
Beispiel #6
0
/***	void IOShieldOledClass::putString(char * sz)
**
**	Parameters:
**		sz		- pointer to the null terminated string
**
**	Return Value:
**		none
**
**	Errors:
**		none
**
**	Description:
**		Write the specified null terminated character string to the
**		display and advance the cursor.
*/
void IOShieldOledClass::putString(char * sz)
{
	OledPutString(sz);
}
Beispiel #7
0
void displayOnOLED(char *str, int row){
    if (!*str) return;
    OledSetCursor(0, row);
    OledPutString(str);
}
Beispiel #8
0
int main() {

    char t[2];
    char pos[2];
    DelayInit();                             //initializations and state resets
    OledInit();
    Timer2Init();
    initLEDs();
    initButtons();
    initRotary();
    setLEDstate(0);
    unsigned int time = 0;

    OledClearBuffer();                        //the OLED is cleared
    OledSetCursor(0, 0);                      //OLED cursor reset to first line
    OledPutString("ECE 2534 Lab 2");          //message displayed
    OledSetCursor(0, 1);                      //cursor moves to second line
    OledPutString("Thomas Yu");               //message displayed
    OledSetCursor(0, 2);                      //cursor moves to third
    OledPutString("LOCKED");                  //message displayed
    OledSetCursor(0, 3);                      //cursor moves to third
    OledPutString("0");                       //message displayed
    OledUpdate();

    while (1)
    {
        OledSetCursor(0, 3);                      //cursor moves to third
        sprintf(pos, "%-2d", state);              //state(int) converted to string
        OledPutString(pos);                       //message displayed
        OledUpdate();

        if (go == 1)
        {
            sec1000 = 0;                          //time reset
            while (sec1000 < 15000)               //increments for 15000 ms, or 15 secs
            {
                OledSetCursor(0, 3);                      //cursor moves to third
                sprintf(pos, "%-2d", state);
                OledPutString(pos);                       //current state updated
                OledUpdate();

                OledSetCursor(14,3);                        //the countdown is updated
                sprintf(t, "%-2u", (15 - (sec1000/1000)));  //the current time left in seconds is the
                OledPutString(t);                           //elapsed ms subtracted from 15000
                OledUpdate();

                if (unlocked == 1)
                {
                    setLEDstate(1);                         //if unlocked then the led is turned on
                    OledSetCursor(14,3);
                    OledPutString("  ");                    //the countdown is cleared
                    OledSetCursor(0,2);
                    OledPutString("OPEN  ");                //open is displayed
                    OledUpdate();

                    while (!getButtonState())               //this runs until button1 is pressed
                    {
                        OledSetCursor(0, 3);                // this block of code continues to update
                        sprintf(pos, "%-2d", state);        //the rotary position as it is moved
                        OledPutString(pos);                       
                        OledUpdate();
                    }

                    OledSetCursor(0,2);                     //after button1 is pressed, the lock is reset
                    OledPutString("LOCKED");
                    setLEDstate(0);
                    go = 0;
                    unlocked = 0;
                    r1 = 0;
                    lock = 0;
                }
            }

            if ( go != 0)                             //if go was never set back to zero, then the
            {                                         //correct combination was never entered
                unsigned int a = sec1000;             //and the timer ran out
                while (sec1000 < a + 1000)            //this while loop runs for 1 second
                {
                    OledSetCursor(7,3);               //Time Out! is displayed for the duration
                    OledPutString("Time Out!");
                    OledUpdate();
                }
                OledSetCursor(7,3);                   //Time Out! is cleared and the lock is reset
                OledPutString("         ");
                OledUpdate();
                go = 0;
                r1 = 0;
                lock = 0;
            }
            
        }
    }


   return 0;
}
void IOShieldOledClass::putString(const char * sz)
{
	OledPutString((char *)sz);
}