Example #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();
}
Example #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();
}
Example #3
0
void printTime(int min, int sec) {
    char temp1[10];
    OledSetCursor(10, 10);
    sprintf(temp1, "%d:%02d", min, sec);
    OledClear();
    OledPutString(temp1);
}
Example #4
0
void
OledDvrInit()
	{
	int		ib;

	/* Init the parameters for the default font
	*/
	dxcoOledFontCur = cbOledChar;
	dycoOledFontCur = 8;
	pbOledFontCur = rgbOledFont0;
	pbOledFontUser = rgbOledFontUser;

	for (ib = 0; ib < cbOledFontUser; ib++) {
		rgbOledFontUser[ib] = 0;
	}

	xchOledMax = ccolOledMax / dxcoOledFontCur;
	ychOledMax = crowOledMax / dycoOledFontCur;

	/* Set the default character cursor position.
	*/
	OledSetCursor(0, 0);

	/* Set the default foreground draw color and fill pattern
	*/
	clrOledCur = 0x01;
	pbOledPatCur = rgbFillPat;
	OledSetDrawMode(modOledSet);

	/* Default the character routines to automaticall
	** update the display.
	*/
	fOledCharUpdate = 1;

}
Example #5
0
/*
    Initializes the OLED for debugging purposes
*/
void beginMyOled(){
   DelayInit();
   OledInit();

   OledSetCursor(0, 0);
   OledClearBuffer();
   OledUpdate();
}
Example #6
0
void
OledAdvanceCursor()
	{

	xchOledCur += 1;
	if (xchOledCur >= xchOledMax) {
		xchOledCur = 0;
		ychOledCur += 1;
	}
	if (ychOledCur >= ychOledMax) {
		ychOledCur = 0;
	}

	OledSetCursor(xchOledCur, ychOledCur);

}
Example #7
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");
}
Example #8
0
/***	void IOShieldOledClass::setCursor(int xch, int ych);
**
**	Parameters:
**		xch			- horizontal character position
**		ych			- vertical character position
**
**	Return Value:
**		none
**
**	Errors:
**		none
**
**	Description:
**		Set the character cursor position to the specified location.
**		If either the specified X or Y location is off the display, it
**		is clamped to be on the display.
*/
void IOShieldOledClass::setCursor(int xch, int ych)
{
	OledSetCursor(xch,ych);
}
Example #9
0
void displayOnOLED(char *str, int row){
    if (!*str) return;
    OledSetCursor(0, row);
    OledPutString(str);
}
Example #10
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;
}