void OledClear() { OledClearBuffer(); OledUpdate(); }
//the graph boundaries and lines are drawn void setupGraph() { int xco = 0; int yco = 0; //Solid boundaries drawn OledClearBuffer(); OledMoveTo(0,0); OledLineTo(127,0); OledMoveTo(0,30); OledLineTo(127,30); OledMoveTo(0,0); OledLineTo(0,31); OledMoveTo(127,0); OledLineTo(127,31); //dashed boundaries drawn for (xco = 0; xco < 127; xco = xco+5) { OledMoveTo(xco,15); OledLineTo(xco+2,15); } for (xco = 40; xco < 121; xco = xco + 40) { OledMoveTo(xco,0); for (yco = 0; yco < 31; yco = yco + 5) { OledMoveTo(xco,yco); OledLineTo(xco, yco+2); } } }
/* Initializes the OLED for debugging purposes */ void beginMyOled(){ DelayInit(); OledInit(); OledSetCursor(0, 0); OledClearBuffer(); OledUpdate(); }
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(); }
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(); }
/*** void IOShieldOledClass::clearBuffer(void) ** ** Parameters: ** none ** ** Return Value: ** none ** ** Errors: ** none ** ** Description: ** Clear the display memory buffer. */ void IOShieldOledClass::clearBuffer(void) { OledClearBuffer(); }
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; }