void Clock::displayColor(bool onOff) { Digit hour1(x, y), hour2(x, y+10), min1(x, y+25), min2(x, y+35), sec1(x, y+50), sec2(x, y+60); hour1.changeColor(true); hour2.changeColor(true); min1.changeColor(true); min2.changeColor(true); sec1.changeColor(true); sec2.changeColor(true); if(onOff) { clearDisplay(); hour1.display(hr/10, true); hour2.display(hr%10, true); min1.display(min/10, true); min2.display(min%10, true); sec1.display(sec/10, isSec); sec2.display(sec%10, isSec); if(isPM) { attron(COLOR_PAIR(BLACKONYELLOW)); mvprintw(x+6, y-5, "PM"); attroff(COLOR_PAIR(BLACKONYELLOW)); } else { attron(COLOR_PAIR(WHITEONBLACK)); mvprintw(x+6, y-5, " "); } refresh(); } else clearDisplay(); }
void main() { unsigned char x, y, xdir, ydir; unsigned int i; // === Initialize system ================================================ IFG1=0; /* clear interrupt flag1 */ WDTCTL=WDTPW+WDTHOLD; /* stop WD */ init(); initNokia(); clearDisplay(); x=4; y=4; ydir=1; xdir=1; drawBlock(y,x); while(1) { if (ydir ==1){ y++; if(y>=8) ydir=0; } if (ydir==0){ y--; if(y<=0) ydir=1; } if (xdir ==1){ x++; if (x>=11) xdir = 0; } if(xdir==0){ x--; if(x<=0) xdir =1; } clearDisplay(); drawBlock(y,x); for(i=0; i<10; i++){ moveDelay(); } } }
Me7SegmentDisplay::Me7SegmentDisplay(uint8_t port): MePort(port) { pinMode(s2, OUTPUT); pinMode(s1, OUTPUT); set(); clearDisplay(); }
SharpMemory::SharpMemory(uint8_t chipSelect): Adafruit_GFX(DISPLAY_WIDTH, DISPLAY_HEIGHT) { // Store the CS Pin csPin = chipSelect; // Set the pin low digitalWrite(csPin, LOW); // Set the pin as an output pinMode(csPin, OUTPUT); // Initialize VCOM state vcomHigh = false; // Set the flag for knowing if there are changes that need to be written hasChanges = false; for(unsigned int index = 0; index < sizeof(lineHasChanges); index++) { lineHasChanges[index] = false; } // Initialize SPI library SPI.begin(); // Clear the display after initialization clearDisplay(); }
void LOOL_OLED::begin() { _i2caddr = 0x3C; Wire.begin(); // Is this the right place for this? delayMicroseconds(50); ssd1306_command(SSD1306_DISPLAYOFF); // 0xAE ssd1306_command(SSD1306_SETDISPLAYCLOCKDIV); // 0xD5 ssd1306_command(0x80); // the suggested ratio 0x80 ssd1306_command(SSD1306_SETMULTIPLEX); // 0xA8 ssd1306_command(0x3F); ssd1306_command(SSD1306_SETDISPLAYOFFSET); // 0xD3 ssd1306_command(0x0); // no offset ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0 ssd1306_command(SSD1306_CHARGEPUMP); // 0x8D ssd1306_command(0x14); ssd1306_command(SSD1306_MEMORYMODE); // 0x20 ssd1306_command(0x00); // 0x0 act like ks0108 ssd1306_command(SSD1306_SEGREMAP | 0x1); ssd1306_command(SSD1306_COMSCANDEC); ssd1306_command(SSD1306_SETCOMPINS); // 0xDA ssd1306_command(0x12); ssd1306_command(SSD1306_SETCONTRAST); // 0x81 ssd1306_command(0xCF); ssd1306_command(SSD1306_SETPRECHARGE); // 0xd9 ssd1306_command(0xF1); ssd1306_command(SSD1306_SETVCOMDETECT); // 0xDB ssd1306_command(0x40); ssd1306_command(SSD1306_DISPLAYALLON_RESUME); // 0xA4 ssd1306_command(SSD1306_NORMALDISPLAY); // 0xA6 ssd1306_command(SSD1306_DISPLAYON);//--turn on oled panel clearDisplay(); }
void PrintMenu(char *menu, int select){ clearDisplay(); setAddrPointer( 0x00 , 0x00 ); size_t line=0, chs = 0, i=0; if(select==line){ PrintChar('>'); } else{ PrintChar(' '); } chs++; while(menu[i]!='\0'){ if(menu[i]=='\n'){ while(chs++<20){ PrintChar(' '); } if(++line == select){ PrintChar('>'); } else{ PrintChar(' '); } chs = 1; } else{ chs++; PrintChar(menu[i]); } i++; } PrintEmptyLine(); PrintEmptyLine(); PrintEmptyLine(); PrintEmptyLine(); PrintEmptyLine(); }
/** * @brief Initialisiert das Display * */ void initDisplay() { DDRB |= 0xfc; resetRS(); PORTB |= 0x30; PORTB &= 0x3f; _delay_ms(15); toggleEnable(); _delay_ms(5); toggleEnable(); _delay_us(200); toggleEnable(); PORTB |= 0x20; PORTB &= 0x2f; toggleEnable(); _delay_ms(3); writeCommand(0x2C); writeCommand(0x0E); clearDisplay(); }
int UVCPreview::stopPreview() { ENTER(); bool b = isRunning(); if (LIKELY(b)) { mIsRunning = false; pthread_cond_signal(&preview_sync); pthread_cond_signal(&capture_sync); if (pthread_join(capture_thread, NULL) != EXIT_SUCCESS) { LOGW("UVCPreview::terminate capture thread: pthread_join failed"); } if (pthread_join(preview_thread, NULL) != EXIT_SUCCESS) { LOGW("UVCPreview::terminate preview thread: pthread_join failed"); } clearDisplay(); } clearPreviewFrame(); clearCaptureFrame(); pthread_mutex_lock(&preview_mutex); if (mPreviewWindow) { ANativeWindow_release(mPreviewWindow); mPreviewWindow = NULL; } pthread_mutex_unlock(&preview_mutex); pthread_mutex_lock(&capture_mutex); if (mCaptureWindow) { ANativeWindow_release(mCaptureWindow); mCaptureWindow = NULL; } pthread_mutex_unlock(&capture_mutex); RETURN(0, int); }
void initializeDisplay() { pinMode(13, OUTPUT); pinOutput(13, LOW); pinMode(R1_PIN,OUTPUT); pinMode(G1_PIN,OUTPUT); pinMode(B1_PIN,OUTPUT); pinMode(R2_PIN,OUTPUT); pinMode(G2_PIN,OUTPUT); pinMode(B2_PIN,OUTPUT); pinMode(CLK_PIN,OUTPUT); pinMode(OE_PIN,OUTPUT); pinMode(A_PIN,OUTPUT); pinMode(B_PIN,OUTPUT); pinMode(C_PIN,OUTPUT); pinMode(LAT_PIN,OUTPUT); pinOutput(A_PIN, 0); pinOutput(B_PIN, 0); pinOutput(C_PIN, 0); pinOutput(LAT_PIN, 0); pinOutput(OE_PIN, 0); pinOutput(CLK_PIN, 1); startTimer(TC1, 0, TC3_IRQn, 1000); clearDisplay(); }
LedControl::LedControl(int dataPin, int clkPin, int csPin, int numDevices, bool anode, bool reflect, bool upsidedown) { SPI_MOSI=dataPin; SPI_CLK=clkPin; SPI_CS=csPin; if(numDevices<=0 || numDevices>8 ) numDevices=8; maxDevices=numDevices; anodeMode=anode; reflectMode=reflect; upsidedownMode=upsidedown; pinMode(SPI_MOSI,OUTPUT); pinMode(SPI_CLK,OUTPUT); pinMode(SPI_CS,OUTPUT); digitalWrite(SPI_CS,HIGH); SPI_MOSI=dataPin; for(int i=0;i<64;i++) { status[i]=0x00; statusTransposed[i]=0x00; } for(int i=0;i<maxDevices;i++) { spiTransfer(i,OP_DISPLAYTEST,0); //scanlimit is set to max on startup setScanLimit(i,7); //decode is done in source spiTransfer(i,OP_DECODEMODE,0); clearDisplay(i); //we go into shutdown-mode on startup shutdown(i,true); } }
void main(void) { unsigned char difficulty = 0; unsigned char input = 0; P1_4 = 1; /* init hardware */ fb_init(); keyboard_init(); EA = 1; // enable global interrupts /* show our startdisplay */ display_start(difficulty); while(1) { input = readBuf(); /* change difficulty which results in changing speed */ if(input == SHIFT_KEY) { difficulty++; if(difficulty > 2) { difficulty = 0; } display_start(difficulty); } /* start game with space */ if(input == SPACE_KEY) { clearDisplay(); start_game(15000 - difficulty*5000); display_start(difficulty); } } }
void GameOfLight::begin() { #if defined(GameOfLightHW) Serial.begin(500000); //DEBUG // Initialize the communication with the display controller SPI.begin(); SPI.setClockDivider(SPI_CLOCK_DIV8); pinMode(SCREEN_SS_PIN, OUTPUT); pinMode(controller[0], INPUT); pinMode(controller[1], INPUT); pinMode(controller[2], INPUT); pinMode(controller[3], INPUT); pinMode(SNES_CLK_PIN, OUTPUT); pinMode(SNES_LATCH_PIN, OUTPUT); digitalWrite(SCREEN_SS_PIN, HIGH); digitalWrite(SCREEN_SS_PIN, LOW); clearDisplay(); controller[0] = 4; controller[1] = 5; controller[2] = 2; controller[3] = 3; //pins on Arduino where the SNES-controller data pins are connected MsTimer2::set(1, btnCallBack); //Autotriggering of the getButton-routine every 1ms Serial.println("HW"); //DEBUG #else Serial.begin(500000); MsTimer2::set(15, btnCallBack); btnRequestSent = 0; Serial.println("Sim"); //DEBUG #endif _screen_line = 0; _screen_index = 0; resetButtons(); setFont(FONT_5x7); MsTimer2::start(); }
void initializeDisplay() { pinMode(R1_PIN,OUTPUT); pinMode(G1_PIN,OUTPUT); pinMode(B1_PIN,OUTPUT); pinMode(R2_PIN,OUTPUT); pinMode(G2_PIN,OUTPUT); pinMode(B2_PIN,OUTPUT); pinMode(CLK_PIN,OUTPUT); pinMode(OE_PIN,OUTPUT); pinMode(A_PIN,OUTPUT); pinMode(B_PIN,OUTPUT); pinMode(C_PIN,OUTPUT); pinMode(D_PIN,OUTPUT); pinMode(LAT_PIN,OUTPUT); pinOutput(A_PIN, 0); pinOutput(B_PIN, 0); pinOutput(C_PIN, 0); pinOutput(D_PIN, 0); pinOutput(LAT_PIN, 0); pinOutput(OE_PIN, 0); pinOutput(CLK_PIN, 1); clearDisplay(); startTimer(TC1, 0, TC3_IRQn, 100); //TC1 channel 0, the IRQ for that channel and the desired frequency }
LedControl::LedControl(int dataPin, int clkPin, int csPin, int numDevices) { LEDCONTROL_SPI_MOSI=dataPin; LEDCONTROL_SPI_CLK=clkPin; LEDCONTROL_SPI_CS=csPin; if(numDevices<=0 || numDevices>8 ) numDevices=8; maxDevices=numDevices; pinMode(LEDCONTROL_SPI_MOSI,OUTPUT); pinMode(LEDCONTROL_SPI_CLK,OUTPUT); pinMode(LEDCONTROL_SPI_CS,OUTPUT); digitalWrite(LEDCONTROL_SPI_CS,HIGH); LEDCONTROL_SPI_MOSI=dataPin; for(int i=0;i<64;i++) status[i]=0x00; for(int i=0;i<maxDevices;i++) { spiTransfer(i,OP_DISPLAYTEST,0); //scanlimit is set to max on startup setScanLimit(i,7); //decode is done in source spiTransfer(i,OP_DECODEMODE,0); clearDisplay(i); //we go into shutdown-mode on startup shutdown(i,true); } }
void main(void) { unsigned char tmp; unsigned char x = 0; P1_4 = 1; //P1_4 = 0; fb_init(); keyboard_init(); EA = 1; // enable global interrupts clearDisplay(); drawRectangle(0,0,13,19); while(1) { /* tmp = readBuf(); if(tmp == 0x34) { if(x == 0){ setPx(2,2); x = 1; } else { clearPx(2,2); x = 0; } } */ } }
void playf(void) { clearDisplay(); m_port_set(0x20, PORTG,4); //Display 1 m_port_set(0x20, PORTG,6); state = 0x00; }
void OpenglManager::clearAllDisplays() { for (int disp = 0; disp < GLDisplay::numDisplays; disp++) { clearDisplay((GLDisplay::display)disp); } return; }
void main() { unsigned char x, y, xVel, yVel; // === Initialize system ================================================ IFG1=0; /* clear interrupt flag1 */ WDTCTL=WDTPW+WDTHOLD; /* stop WD */ init(); initNokia(); clearDisplay(); x=4; y=4; xVel=1; yVel=1; drawBlock(y,x); while(1) { // Vel = 1 going right/down // Vel = 0 going left/up if (xVel == 1) { x++; if (x>=11) xVel=0; } if (xVel == 0) { x--; if (x<=0) xVel=1; } if (yVel == 1) { y++; if (y>=7) yVel=0; } if (yVel == 0) { y--; if (y<=0) yVel=1; } clearDisplay(); drawBlock(y,x); delayDraw(); } }
Me7SegmentDisplay::Me7SegmentDisplay(uint8_t dataPin,uint8_t clkPin) { s1 = dataPin; s2 = clkPin; pinMode(s2, OUTPUT); pinMode(s1, OUTPUT); set(); clearDisplay(); }
/** * Alternate Constructor which can call your own function to map the 7-Segment display to arduino port. * \param[in] * dataPin - The DATA pin for Seven-Segment LED module(arduino port). * \param[in] * clkPin - The CLK pin for Seven-Segment LED module(arduino port). */ Me7SegmentDisplay::Me7SegmentDisplay(uint8_t dataPin, uint8_t clkPin) { _dataPin = dataPin; _clkPin = clkPin; pinMode(_clkPin, OUTPUT); pinMode(_dataPin, OUTPUT); set(); clearDisplay(); }
/** * Alternate Constructor which can call your own function to map the 7-Segment display to arduino port, * the slot1 will be used for data pin and slot2 will used for clk pin. * \param[in] * port - RJ25 port from PORT_1 to M2 */ Me7SegmentDisplay::Me7SegmentDisplay(uint8_t port) : MePort(port) { _dataPin = s1; _clkPin = s2; pinMode(_clkPin, OUTPUT); pinMode(_dataPin, OUTPUT); set(); clearDisplay(); }
//Enable LCD UART Protocol void enable_LCD() { //Baud rate = 9600, uart1 enabled, base clock chosen and uart configuration at a buffer size of 8 UARTConfigSetExpClk(b1, SysCtlClockGet(), 9600, UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE); UARTEnable(b1); changeCursorUnderscore(); clearDisplay(); }
int main (void) { // Insert system clock initialization code here (sysclk_init()). board_init(); sysclk_init(); // Insert application code here, after the board has been initialized. //Initiera delay delay_init(); //Initiera LCD LCDInit(); //Initiera AD-omvandlare adc_setup(); //Starta upp LCD setupLCD(); //Initiera interupt configure_tc(); int delay_time = 200000; /* variable determining the length of a delay */ PIOB_init(27); for (;;) /* repeat blink in infinity */ { letterS(delay_time); paus(delay_time * 3); letterO(delay_time); paus(delay_time * 3); letterS(delay_time); paus(delay_time * 5); clearDisplay(); delay(delay_time); printNumber(result); } return 0; }
Me7SegmentDisplay::Me7SegmentDisplay(uint8_t port):MePort(port) { Clkpin = s2; Datapin = s1; pinMode(Clkpin,OUTPUT); pinMode(Datapin,OUTPUT); set(); clearDisplay(); }
void Hacklace_AppEngine::resetApp() { // Terminate the current app and set first app to be the next one. if (app) { app->finish(); } app = NULL; clearDisplay(); ee_ptr = EE_START_ADDR; }
void main() { byte pattern[GHOST_WD] = {GHOST}; // Initialize the happy face pattern in memory ballStruct ball; //Initalize all the ball parameters ball.position.x = 5; ball.position.y = 5; ball.velocity.x = -1; ball.velocity.y = -1; ball.pattern = pattern; ball.width = GHOST_WD; ballStruct *ballPtr = &ball; // === Initialize system ================================================ IFG1=0; /* clear interrupt flag1 */ WDTCTL=WDTPW+WDTHOLD; /* stop WD */ init(); initNokia(); initInterrupt(); clearDisplay(); drawBall(ballPtr); while(1) { if(!(TACTL & (BIT5|BIT4))) // The program uses the Memory Control register to check if there is an inturrupt, an inturrupt has occured with the clock has stopped { clearDisplay(); moveBall(ballPtr); drawBall(ballPtr); TACTL |= MC_1; // Reset the Memory Control register to count up mode and resume (this process is fairly nice as it slows down the refresh speed) } } }
void DataInspectionDialog::displayImage() { clearDisplay(); imgRow = nRows/2; imgCol = nCols/2; imgSlice = nSlices/2; plotCoronal(imgRow); plotSagittal(imgCol); plotAxial(imgSlice); }
void display_banner(Game& user) { clearDisplay(1); printw("--------------------------------------------------------------------------\n"); printw("Hello "); printw("%s", user.getName().c_str()); printw ("!!!\tLocation: "); printw("%s",user.getLocation().c_str()); printw("\tEnergy: "); printw("%d", user.getEnergy()); printw("\tSteps: "); printw("%d", user.getSteps(), "\n"); printw("\n--------------------------------------------------------------------------\n"); refresh(); }
int main( void ) { unsigned int i; InitPorts(); InitLCD(); clearDisplay(); printString("Test LCD"); Delay(10000); return 0; }
SevenSegment::SevenSegment(int dataPin, int clkPin, int maxDigits) { data_pin = dataPin; clock_pin = clkPin; maxdigits = maxDigits; if (maxdigits > NDIGITS) maxdigits = NDIGITS; debugFlag = 0; pinMode(data_pin,OUTPUT); pinMode(clock_pin,OUTPUT); digitalWrite(clock_pin,LOW); clearDisplay(); }