http://www.adafruit.com/datasheets/BST-BME280-DS001-11.pdf
426484
function(options) {
    options = options || {};
    options.device = options.device || '/dev/i2c-1';
    options.debug = options.debug || false;
  
    var address = BME280.I2C_ADDRESS_A;
    if ('address' in options)
        address = options.address;

    this.wire = new i2c(address, options);
}
991715
def convert_ram_sdp_rf(ADDR_WIDTH=8, DATA_WIDTH=8):
    '''  '''
    clk = Signal(bool(0))
    we = Signal(bool(0))
    addrw = Signal(intbv(0)[ADDR_WIDTH:])
    addrr = Signal(intbv(0)[ADDR_WIDTH:])
    di = Signal(intbv(0)[DATA_WIDTH:])
    do = Signal(intbv(0)[DATA_WIDTH:])
    toVerilog(ram_sdp_rf, clk, we, addrw, addrr, di, do)
375226
public final void pextrb(Register dst, XMMRegister src, Immediate imm8)
  {
    emitX86(INST_PEXTRB, dst, src, imm8);
  }
87519
def _format_capability_report(self, data):
        

        if self.log_output:
            return

        else:
            pin_modes = {0: 'Digital_Input', 1: 'Digital_Output',
                         2: 'Analog', 3: 'PWM', 4: 'Servo',
                         5: 'Shift', 6: 'I2C', 7: 'One Wire',
                         8: 'Stepper', 9: 'Encoder'}
            x = 0
            pin = 0

            print('\nCapability Report')
            print('-----------------\n')
            while x < len(data):
                # get index of next end marker
                print('{} {}{}'.format('Pin', str(pin), ':'))
                while data[x] != 127:
                    mode_str = ""
                    pin_mode = pin_modes.get(data[x])
                    mode_str += str(pin_mode)
                    x += 1
                    bits = data[x]
                    print('{:>5}{}{} {}'.format('  ', mode_str, ':', bits))
                    x += 1
                x += 1
                pin += 1
1243003
def _memdata(osdata):
    '''
    
    '''
    # Provides:
    #   mem_total
    #   swap_total, for supported systems.
    grains = {'mem_total': 0}
    if osdata['kernel'] == 'Linux':
        grains.update(_linux_memdata())
    elif osdata['kernel'] in ('FreeBSD', 'OpenBSD', 'NetBSD'):
        grains.update(_bsd_memdata(osdata))
    elif osdata['kernel'] == 'Darwin':
        grains.update(_osx_memdata())
    elif osdata['kernel'] == 'SunOS':
        grains.update(_sunos_memdata())
    elif osdata['kernel'] == 'AIX':
        grains.update(_aix_memdata())
    elif osdata['kernel'] == 'Windows' and HAS_WMI:
        grains.update(_windows_memdata())
    return grains
433253
def _get_crmod_abmn(self):
        
        ABMN = np.vstack((
            self.configs[:, 0] * 1e4 + self.configs[:, 1],
            self.configs[:, 2] * 1e4 + self.configs[:, 3],
        )).T.astype(int)
        return ABMN
1152188
def dms2dd(d,m,s):
    
    if d < 0:
        sign = -1
    else:
        sign = 1
    dd = sign * (int(abs(d)) + float(m) / 60 + float(s) / 3600)
    return dd
861307
def part_specs(self, part):
        '''
        
        '''
        result = self._e.parts_match(
            queries=[{'mpn_or_sku': part}],
            exact_only=True,
            show_mpn=True,
            show_manufacturer=True,
            show_octopart_url=True,
            show_short_description=True,
            show_specs=True,
            show_category_uids=True,
            show_external_links=True,
            show_reference_designs=True,
            show_cad_models=True,
            show_datasheets=True,
            include_specs=True,
            include_category_uids=True,
            include_external_links=True,
            include_reference_designs=True,
            include_cad_models=True,
            include_datasheets=True
        )
        if result[1][0]['hits'] == 0:
            print("No result")
            return ReturnValues.NO_RESULTS

        result = result[1][0]['items'][0]
        print("Showing specs for '{}':".format(result['mpn']))
        print(" → Manufacturer:      {}".format(result['manufacturer']['name']))
        print("  → Specifications:    ")
        for k,v in result['specs'].items():
            name = v['metadata']['name'] if v['metadata']['name'] else k
            min_value = v['min_value'] if v['min_value'] else ''
            max_value = v['max_value'] if v['max_value'] else ''
            unit = ' ({})'.format(v['metadata']['unit']['name']) if v['metadata']['unit'] else ''
            value = ','.join(v['value']) if len(v['value']) > 0 else ''

            if value and not (min_value or max_value):
                print("    → {:20}: {}{}".format(name, value, unit))
            elif value and min_value and max_value:
                print("    → {:20}: {}{} (min: {}, max: {})".format(name, value, unit, min_value, max_value))
            elif not value and min_value and max_value:
                print("    → {:20}:{} min: {}, max: {}".format(name, unit, min_value, max_value))
            elif not value and min_value and not max_value:
                print("    → {:20}:{} min: {}".format(name, unit, min_value))
            elif not value and not min_value and max_value:
                print("    → {:20}:{} max: {}".format(name, unit, max_value))

        print(" → URI:               {}".format(result['octopart_url']))
        if result['external_links']['evalkit_url'] \
                or result['external_links']['freesample_url'] \
                or result['external_links']['product_url']:
            print("  → External Links")
            if result['external_links']['evalkit_url']:
                print("    → Evaluation kit: {}".format(result['external_links']['evalkit_url']))
            if result['external_links']['freesample_url']:
                print("    → Free Sample: {}".format(result['external_links']['freesample_url']))
            if result['external_links']['product_url']:
                print("    → Product URI: {}".format(result['external_links']['product_url']))
        if len(result['datasheets']) > 0:
            print("  → Datasheets")
            for datasheet in result['datasheets']:
                print("    → URL:      {}".format(datasheet['url']))
                if datasheet['metadata']:
                    print("      → Updated:  {}".format(datasheet['metadata']['last_updated']))
                    print("      → Nb Pages: {}".format(datasheet['metadata']['num_pages']))
        if len(result['reference_designs']) > 0:
            print("  → Reference designs: ")
        if len(result['cad_models']) > 0:
            print("  → CAD Models:        ")
        return ReturnValues.OK
510636
public final void bsr(Register dst, Mem src)
  {
    assert(!dst.isRegType(REG_GPB));
    emitX86(INST_BSR, dst, src);
  }
488312
def systemInformationType13():
    """"""
    a = L2PseudoLength(l2pLength=0x00)
    b = TpPd(pd=0x6)
    c = MessageType(mesType=0x0)  # 00000000
    d = Si13RestOctets()
    packet = a / b / c / d
    return packet
898150
def _abs16(ins):
    ''' 
    '''
    output = _16bit_oper(ins.quad[2])
    output.append('call __ABS16')
    output.append('push hl')
    REQUIRES.add('abs16.asm')
    return output
1321404
def systemInformationType2ter():
    """"""
    a = L2PseudoLength(l2pLength=0x12)
    b = TpPd(pd=0x6)
    c = MessageType(mesType=0x3)  # 00000011
    d = NeighbourCellsDescription2()
    e = Si2terRestOctets()
    packet = a / b / c / d / e
    return packet
156830
def small_register_machine(rom_size = 50, ram_size = 200, flash_size = 500):
	
	rom = memory.ROM(rom_size)
	ram = memory.RAM(ram_size)
	flash = device.Flash(flash_size)

	proc = processor.Processor()

	proc.register_memory_device(rom)
	proc.register_memory_device(ram)
	proc.register_device(flash)

	registers = [register.OutputRegister("out0", sys.stdout),
		register.Register("r0"),
		register.Register("r1"),
		register.Register("r2"),
		register.Register("r3"),
		register.Register("r4"),
		register.Register("r5"),
		register.Register("r6"),
		register.Register("r7"),
		register.Register("r8"),
		register.Register("r9"),
		register.Register("r10"),
		register.Register("r11"),
		register.Register("r12"),
		register.Register("r13"),
		register.Register("r14")]

	for r in registers:
		proc.add_register(r)

	for command in basic_commands:
		proc.register_command(command)

	return (proc, rom, ram, flash)
75360
public final void mpsadbw(XMMRegister dst, XMMRegister src, Immediate imm8)
  {
    emitX86(INST_MPSADBW, dst, src, imm8);
  }
902897
function expm1( x ) {
	var half_x;
	var sign;
	var hi;
	var lo;
	var hx;
	var r1;
	var y;
	var z;
	var c;
	var t;
	var e;
	var k;

	if ( x === PINF || x !== x ) {
		return x;
	}
	if ( x === NINF ) {
		return -1;
	}
	if ( x === 0 ) {
		return x; // handles +-0 (IEEE 754-2008)
	}
	// Set y = |x|:
	if ( x < 0 ) {
		sign = true;
		y = -x;
	} else {
		sign = false;
		y = x;
	}
	// Filter out huge and non-finite arguments...
	if ( y >= LN2x56 ) { // if |x| >= 56*ln(2)
		if ( sign ) { // if x <= -56*ln(2)
			return -1;
		}
		if ( y >= OVERFLOW_THRESHOLD ) { // if |x| >= 709.78...
			return PINF;
		}
	}
	// Extract the more significant bits from |x|:
	hx = highWord( y );

	// Argument reduction...
	if ( y > LN2_HALF ) { // if |x| > 0.5*ln(2)
		if ( y < LN2_HALFx3 ) { // if |x| < 1.5*ln(2)
			if ( sign ) {
				hi = x + LN2_HI;
				lo = -LN2_LO;
				k = -1;
			} else {
				hi = x - LN2_HI;
				lo = LN2_LO;
				k = 1;
			}
		} else {
			if ( sign ) {
				k = LN2_INV*x - 0.5;
			} else {
				k = LN2_INV*x + 0.5;
			}
			k = k|0; // use a bitwise OR to cast `k` to an integer (see also asm.js type annotations: http://asmjs.org/spec/latest/#annotations)
			t = k;
			hi = x - t*LN2_HI; // t*ln2_hi is exact here
			lo = t * LN2_LO;
		}
		x = hi - lo;
		c = (hi-x) - lo;
	}
	// if |x| < 2**-54 => high word: 0 01111001001 00000000000000000000 => 0x3c900000 = 1016070144  => exponent = 01111001001 = 969 = 1023-54
	else if ( hx < 1016070144 ) {
		return x;
	}
	else {
		k = 0;
	}
	// x is now in primary range...
	half_x = 0.5 * x;
	z = x * half_x;

	r1 = 1.0 + z*polyval( z );

	t = 3.0 - r1*half_x;
	e = z * ( (r1-t) / (6.0 - x*t) );
	if ( k === 0 ) {
		return x - ( x*e - z );	// c is 0
	}
	e = x*(e-c) - c;
	e -= z;
	if ( k === -1 ) {
		return 0.5*(x-e) - 0.5;
	}
	if ( k === 1 ) {
		if ( x < -0.25 ) {
			return -2.0 * ( e - (x+0.5) );
		}
		return 1 + 2.0*(x-e);
	}
	if ( k <= -2 || k > 56 ) { // suffice to return exp(x)-1
		y = 1 - (e-x);

		// Add k to y's exponent:
		hi = highWord( y ) + (k<<20);
		y = setHighWord( y, hi );

		return y - 1;
	}
	t = 1;
	if ( k < 20 ) {
		// 0x3ff00000 - (0x200000>>k) = 1072693248 - (0x200000>>k) => 0x200000 = 0 00000000010 00000000000000000000
		hi = 1072693248 - (0x200000>>k);
		t = setHighWord( t, hi ); // t=1-2^-k
		y = t - (e-x);
	} else {
		hi = ( (BIAS-k)<<20 );
		t = setHighWord( t, hi ); // t=2^-k
		y = x - (e+t);
		y += 1;
	}
	// Add k to y's exponent:
	hi = highWord( y ) + (k<<20);
	y = setHighWord( y, hi );
	return y;
}
1255554
def device_statistics(fritz, args):
    """"""
    stats = fritz.get_device_statistics(args.ain)
    print(stats)
236087
function(manufacturerDataString){

  let robject = {};
  let data = manufacturerDataString;
  let dataFormat = data[0] & 0xFF;
  let temperature = (data[1] << 8 | data[2] & 0xFF); 
  if (temperature > 32767) {
    temperature -= 65535;
  }
  temperature /= 200.0;
  let humidity =  ((data[3] & 0xFF) << 8 | data[4] & 0xFF) / 400.0;
  let pressure = ((data[5] & 0xFF) << 8 | data[6] & 0xFF) + 50000;
  let accelerationX = (data[7] << 8 | data[8] & 0xFF) / 1000.0;
  let accelerationY = (data[9] << 8 | data[10] & 0xFF) / 1000.0;
  let accelerationZ = (data[11] << 8 | data[12] & 0xFF) / 1000.0;
  let powerInfo = (data[13] & 0xFF) << 8 | data[14] & 0xFF;
  let batteryVoltage = (powerInfo >>> 5) / 1000.0 + 1.6;
  let txPower = (powerInfo & 0b11111) * 2 - 40;
  let movementCounter = data[15] & 0xFF;
  let measurementSequenceNumber = (data[16] & 0xFF) << 8 | data[17] & 0xFF;
  let mac = toHexString(data.subarray(18));

  robject.destination_endpoint = dataFormat;
  robject.temperature = temperature;
  robject.humidity = humidity;
  robject.pressure = pressure;
  robject.accelerationX = accelerationX;
  robject.accelerationY = accelerationY;
  robject.accelerationZ = accelerationZ;
  robject.batteryVoltage = batteryVoltage;
  robject.txPower = txPower;
  robject.movementCounter = movementCounter;
  robject.measurementSequenceNumber = measurementSequenceNumber;
  robject.mac = mac;

  return robject;
}