Ejemplo n.º 1
0
void OLED::initOLED()
{
	//unsigned char i;
	//make scl high
	setBit(OLED_scl_port,OLED_scl_pin);
	//make rst low
	clrBit(OLED_rst_port,OLED_rst_pin);
	//delay 50 ms
	_delay_ms(50);
	//make rst high
	setBit(OLED_rst_port,OLED_rst_pin);
	setDisplayOnOff(0x00);		  // Display Off (0x00/0x01)
	setDisplayClock(0x80);		  // Set Clock as 100 Frames/Sec
	setMultiplexRatio(0x3F);	  // 1/64 Duty (0x0F~0x3F)
	setDisplayOffset(0x00);		  // Shift Mapping RAM Counter (0x00~0x3F)
	setStartLine(0x00);			  // Set Mapping RAM Display Start Line (0x00~0x3F)
	setChargePump(0x04);		  // Enable Embedded DC/DC Converter (0x00/0x04)
	setAddressingMode(0x02);	  // Set Page Addressing Mode (0x00/0x01/0x02)
	setSegmentRemap(0x01);	  // Set SEG/Column Mapping
	setCommonRemap(0x08);	  // Set COM/Row Scan Direction
	setCommonConfig(0x10);	  // Set Sequential Configuration (0x00/0x10)
	setContrastControl(0xCF); // Set SEG Output Current
	setPrechargePeriod(0xF1);	  // Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
	setVCOMH(0x40);			  // Set VCOM Deselect Level
	setEntireDisplay(0x00);		  // Disable Entire Display On (0x00/0x01)
	setInverseDisplay(0x00);	  // Disable Inverse Display On (0x00/0x01)
	setDisplayOnOff(0x01);		  // Display On (0x00/0x01)
	fill(0x00);                               //clear all
	setPos(0,0);
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
// Function: setEndAddress()
//-----------------------------------------------------------------------------
void FieldGapItem::setEndAddress(quint64 address)
{
    end_ = address;

    setDisplayOffset(end_);
	refresh();
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// Function: FieldGraphItem::updateDisplay()
//-----------------------------------------------------------------------------
void FieldGraphItem::updateDisplay()
{
    setName(field_->getName());

    quint64 leftBound = getLastAddress();
    quint64 rightBound = getOffset();

    setLeftTopCorner(QString::number(leftBound));
    setRightTopCorner(QString::number(rightBound));

    setDisplayOffset(leftBound);
    setDisplayLastAddress(rightBound);
    setToolTip("<b>" + getName() + "</b> [" + QString::number(leftBound) + ".." + 
        QString::number(rightBound) + "]");
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------
// Function: RegisterGraphItem::updateDisplay()
//-----------------------------------------------------------------------------
void RegisterGraphItem::updateDisplay()
{
    QString name = register_->getName();

    if (expressionParser_->parseExpression(register_->getDimensionExpression()).toUInt() > 0)
    {
        name.append("[" + QString::number(dimensionIndex_) + "]");
    }

    quint64 offset = getOffset();
    quint64 lastAddress = getLastAddress();

    setName(name);
    setDisplayOffset(offset);
    setDisplayLastAddress(lastAddress);

    // Set tooltip to show addresses in hexadecimals.
    setToolTip("<b>Name: </b>" + register_->getName() + "<br>" +
        "<b>First address: </b>" + toHexString(offset) + "<br>" +
        "<b>Last address: </b>" + toHexString(lastAddress) + "<br>" +
        "<b>Size [bits]: </b>" + expressionParser_->parseExpression(register_->getSizeExpression()));
}