void VBoxDbgConsoleOutput::sltSelectFontType() { QAction *pAction = qobject_cast<QAction *>(sender()); if (pAction) setFontType((VBoxDbgConsoleFontType)pAction->data().toInt(), true /*fSaveIt*/); }
/** \brief Initialization of edOLED Library. Setup IO pins for SPI port then send initialization commands to the SSD1306 controller inside the OLED. */ void edOLED::begin() { // default 5x7 font setFontType(0); setColor(WHITE); setDrawMode(NORM); setCursor(0,0); spiSetup(); RST_PIN.pinWrite(HIGH); //(digitalWrite(rstPin, HIGH); usleep(5000); // VDD (3.3V) goes high at start, lets just chill for 5 ms RST_PIN.pinWrite(LOW); // bring reset low usleep(10000); // wait 10ms RST_PIN.pinWrite(HIGH); //digitalWrite(rstPin, HIGH); // Init sequence for 64x48 OLED module command(DISPLAYOFF); // 0xAE command(SETDISPLAYCLOCKDIV); // 0xD5 command(0x80); // the suggested ratio 0x80 command(SETMULTIPLEX); // 0xA8 command(0x2F); command(SETDISPLAYOFFSET); // 0xD3 command(0x0); // no offset command(SETSTARTLINE | 0x0); // line #0 command(CHARGEPUMP); // enable charge pump command(0x14); command(NORMALDISPLAY); // 0xA6 command(DISPLAYALLONRESUME); // 0xA4 command(SEGREMAP | 0x1); command(COMSCANDEC); command(SETCOMPINS); // 0xDA command(0x12); command(SETCONTRAST); // 0x81 command(0x8F); command(SETPRECHARGE); // 0xd9 command(0xF1); command(SETVCOMDESELECT); // 0xDB command(0x40); command(DISPLAYON); //--turn on oled panel clear(ALL); // Erase hardware memory inside the OLED }
/** \brief Initialisation of MicroView Library. Setup IO pins for SPI port then send initialisation commands to the SSD1306 controller inside the OLED. */ void MicroView::begin() { // default 5x7 font setFontType(0); setColor(WHITE); setDrawMode(NORM); setCursor(0,0); RESETLOW; // Enable 3.3V power to the display pinMode(OLEDPWR, OUTPUT); digitalWrite(OLEDPWR, HIGH); // Give some time for power to stabilise delay(10); RESETHIGH; delay(5); RESETLOW; // Setup SPI frequency MVSPI.setClockDivider(SPI_CLOCK_DIV2); // Initialise SPI MVSPI.begin(); delay(5); // bring out of reset RESETHIGH; delay(10); // Init sequence for 64x48 OLED module // command(DISPLAYOFF); // 0xAE // command(SETDISPLAYCLOCKDIV, 0x80); // 0xD5 / the suggested ratio 0x80 command(SETMULTIPLEX, 0x2F); // 0xA8 // command(SETDISPLAYOFFSET, 0x0); // 0xD3 / no offset // command(SETSTARTLINE | 0x0); // 0x40 / line #0 command(CHARGEPUMP, 0x14); // 0x8D / enable charge pump // command(NORMALDISPLAY); // 0xA6 // command(DISPLAYALLONRESUME); // 0xA4 command(SEGREMAP | 0x1); command(COMSCANDEC); // command(SETCOMPINS, 0x12); // 0xDA command(SETCONTRAST, 0x8F); // 0x81 command(SETPRECHARGE, 0xF1); // 0xD9 command(SETVCOMDESELECT, 0x40); // 0xDB command(DISPLAYON); //--turn on oled panel clear(ALL); // Erase hardware memory inside the OLED controller to avoid random data in memory. // Serial.begin(115200); // removed the Serial.begin() so that user can decide their own baud rate. }
/** \brief Initialisation of MicroOLED Library. Setup IO pins for SPI port then send initialisation commands to the SSD1306 controller inside the OLED. */ void MicroOLED::begin() { // default 5x7 font setFontType(0); setColor(WHITE); setDrawMode(NORM); setCursor(0,0); pinMode(dcPin, OUTPUT); pinMode(rstPin, OUTPUT); // Set up the selected interface: if (interface == MODE_SPI) spiSetup(); else if (interface == MODE_I2C) i2cSetup(); else if (interface == MODE_PARALLEL) parallelSetup(); // Display reset routine pinMode(rstPin, OUTPUT); // Set RST pin as OUTPUT digitalWrite(rstPin, HIGH); // Initially set RST HIGH delay(5); // VDD (3.3V) goes high at start, lets just chill for 5 ms digitalWrite(rstPin, LOW); // Bring RST low, reset the display delay(10); // wait 10ms digitalWrite(rstPin, HIGH); // Set RST HIGH, bring out of reset // Display Init sequence for 64x48 OLED module command(DISPLAYOFF); // 0xAE command(SETDISPLAYCLOCKDIV); // 0xD5 command(0x80); // the suggested ratio 0x80 command(SETMULTIPLEX); // 0xA8 command(0x2F); command(SETDISPLAYOFFSET); // 0xD3 command(0x0); // no offset command(SETSTARTLINE | 0x0); // line #0 command(CHARGEPUMP); // enable charge pump command(0x14); command(NORMALDISPLAY); // 0xA6 command(DISPLAYALLONRESUME); // 0xA4 command(SEGREMAP | 0x1); command(COMSCANDEC); command(SETCOMPINS); // 0xDA command(0x12); command(SETCONTRAST); // 0x81 command(0x8F); command(SETPRECHARGE); // 0xd9 command(0xF1); command(SETVCOMDESELECT); // 0xDB command(0x40); command(DISPLAYON); //--turn on oled panel clear(ALL); // Erase hardware memory inside the OLED controller to avoid random data in memory. }
VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, IVirtualBox *a_pVirtualBox /* = NULL */, const char *pszName/* = NULL*/) : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()), m_pVirtualBox(a_pVirtualBox) { setReadOnly(true); setUndoRedoEnabled(false); setOverwriteMode(false); setPlainText(""); setTextInteractionFlags(Qt::TextBrowserInteraction); setAutoFormatting(QTextEdit::AutoAll); setTabChangesFocus(true); setAcceptRichText(false); /* * Create actions for color-scheme menu items. */ m_pGreenOnBlackAction = new QAction(tr("Green On Black"), this); m_pGreenOnBlackAction->setCheckable(true); m_pGreenOnBlackAction->setShortcut(Qt::ControlModifier + Qt::Key_1); m_pGreenOnBlackAction->setData((int)kGreenOnBlack); connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(sltSelectColorScheme())); m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this); m_pBlackOnWhiteAction->setCheckable(true); m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2); m_pBlackOnWhiteAction->setData((int)kBlackOnWhite); connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(sltSelectColorScheme())); /* Create action group for grouping of exclusive color-scheme menu items. */ QActionGroup *pActionColorGroup = new QActionGroup(this); pActionColorGroup->addAction(m_pGreenOnBlackAction); pActionColorGroup->addAction(m_pBlackOnWhiteAction); pActionColorGroup->setExclusive(true); /* * Create actions for font menu items. */ m_pCourierFontAction = new QAction(tr("Courier"), this); m_pCourierFontAction->setCheckable(true); m_pCourierFontAction->setShortcut(Qt::ControlModifier + Qt::Key_D); m_pCourierFontAction->setData((int)kFontType_Courier); connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); m_pMonospaceFontAction = new QAction(tr("Monospace"), this); m_pMonospaceFontAction->setCheckable(true); m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M); m_pMonospaceFontAction->setData((int)kFontType_Monospace); connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); /* Create action group for grouping of exclusive font menu items. */ QActionGroup *pActionFontGroup = new QActionGroup(this); pActionFontGroup->addAction(m_pCourierFontAction); pActionFontGroup->addAction(m_pMonospaceFontAction); pActionFontGroup->setExclusive(true); /* * Create actions for font size menu. */ uint32_t const uDefaultFontSize = font().pointSize(); m_pActionFontSizeGroup = new QActionGroup(this); for (uint32_t i = 0; i < RT_ELEMENTS(m_apFontSizeActions); i++) { char szTitle[32]; RTStrPrintf(szTitle, sizeof(szTitle), s_uMinFontSize + i != uDefaultFontSize ? "%upt" : "%upt (default)", s_uMinFontSize + i); m_apFontSizeActions[i] = new QAction(tr(szTitle), this); m_apFontSizeActions[i]->setCheckable(true); m_apFontSizeActions[i]->setData(i + s_uMinFontSize); connect(m_apFontSizeActions[i], SIGNAL(triggered()), this, SLOT(sltSelectFontSize())); m_pActionFontSizeGroup->addAction(m_apFontSizeActions[i]); } /* * Set the defaults (which syncs with the menu item checked state). */ /* color scheme: */ com::Bstr bstrColor; HRESULT hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), bstrColor.asOutParam()) : E_FAIL; if ( SUCCEEDED(hrc) && bstrColor.compareUtf8("blackonwhite", com::Bstr::CaseInsensitive) == 0) setColorScheme(kBlackOnWhite, false /*fSaveIt*/); else setColorScheme(kGreenOnBlack, false /*fSaveIt*/); /* font: */ com::Bstr bstrFont; hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/Font").raw(), bstrFont.asOutParam()) : E_FAIL; if ( SUCCEEDED(hrc) && bstrFont.compareUtf8("monospace", com::Bstr::CaseInsensitive) == 0) setFontType(kFontType_Monospace, false /*fSaveIt*/); else setFontType(kFontType_Courier, false /*fSaveIt*/); /* font size: */ com::Bstr bstrFontSize; hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/FontSize").raw(), bstrFontSize.asOutParam()) : E_FAIL; if (SUCCEEDED(hrc)) { com::Utf8Str strFontSize(bstrFontSize); uint32_t uFontSizePrf = strFontSize.strip().toUInt32(); if ( uFontSizePrf - s_uMinFontSize < (uint32_t)RT_ELEMENTS(m_apFontSizeActions) && uFontSizePrf != uDefaultFontSize) setFontSize(uFontSizePrf, false /*fSaveIt*/); } NOREF(pszName); }