/** * Returns the data change edge, on which the MISO/MOSI lines are allowed to * change. * * @param aMode * the SPI mode to return the data change edge for, cannot be * <code>null</code>. * @return the data change edge. */ public Edge getDataChangeEdge() { return getSampleEdge().invert(); }
/** * Returns the inverse of this edge, so return 'falling' it this is a 'rising' * edge, and the other way around. In case this edge is 'none', 'none' will be * returned. * * @return the inverse of this edge, never <code>null</code>. */ public Edge invert() { if ( isRising() ) { return FALLING; } else if ( isFalling() ) { return RISING; } return NONE; }
/** * Find first falling edge this is the start of the start bit. If the signal * is inverted, find the first rising edge. * * @param aStartOfDecode * the timestamp to start searching; * @param aEndOfDecode * the timestamp to end the search; * @param aMask * the bit-value mask to apply for finding the start bit. * @return the time at which the start bit was found, -1 if it is not found. */ private long findEdge( final AcquisitionResult aData, final long aStartOfDecode, final long aEndOfDecode, final Edge aEdge ) { long result = -1; int oldBitValue = getDataValue( aData, aStartOfDecode ) & this.owLineMask; for ( long timeCursor = aStartOfDecode + 1; ( result < 0 ) && ( timeCursor < aEndOfDecode ); timeCursor++ ) { final int bitValue = getDataValue( aData, timeCursor ) & this.owLineMask; final Edge edge = Edge.toEdge( oldBitValue, bitValue ); if ( aEdge == edge ) { result = timeCursor; } oldBitValue = bitValue; } return result; }
/** * @see nl.lxtreme.ols.client.diagram.settings.GeneralSettingsDialog.EnumItemRenderer#getDisplayValue(java.lang.Enum) */ @Override protected String getDisplayValue( final Edge aValue ) { String text = super.getDisplayValue( aValue ); if ( Edge.FALLING.equals( aValue ) ) { text = "Falling"; } else if ( Edge.RISING.equals( aValue ) ) { text = "Rising"; } return text; } }
long time2 = super.findEdge( aChannelIdx, aEdge.invert(), time, aEndOfDecode );