• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setGain函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setGain函数的典型用法代码示例。如果您正苦于以下问题:C++ setGain函数的具体用法?C++ setGain怎么用?C++ setGain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setGain函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setGain

void UI::actionGain(int g) {
    QString command;
    setGain(false);
    gain=g;
    subRxGain=g;
    setGain(true);
    command.clear(); QTextStream(&command) << "SetRXOutputGain " << g;
    connection.sendCommand(command);
    command.clear(); QTextStream(&command) << "SetSubRXOutputGain " << g;
    connection.sendCommand(command);
}
开发者ID:8cH9azbsFifZ,项目名称:ghpsdr3,代码行数:11,代码来源:UI.cpp


示例2: setTiming

boolean TSL2561::begin(void) {
  Wire.begin();

 // Initialise I2C
  Wire.beginTransmission(_addr);
#if ARDUINO >= 100
  Wire.write(TSL2561_REGISTER_ID);
#else
  Wire.send(TSL2561_REGISTER_ID);
#endif
  Wire.endTransmission();
  Wire.requestFrom(_addr, 1);
#if ARDUINO >= 100
  int x = Wire.read();
#else
  int x = Wire.receive();
#endif
  //Serial.print("0x"); Serial.println(x, HEX);
  if (x & 0x0A ) {
    //Serial.println("Found TSL2561");
  } else {
    return false;
  }
  _initialized = true;

  // Set default integration time and gain
  setTiming(_integration);
  setGain(_gain);
  // Note: by default, the device is in power down mode on bootup
  disable();

  return true;
}
开发者ID:5Hz,项目名称:50042_Sensor_de_luz_TSL2561,代码行数:33,代码来源:TSL2561.cpp


示例3: read8

boolean Adafruit_TSL2591::begin(void)
{
  Wire.begin();

  /*
  for (uint8_t i=0; i<0x20; i++)
  {
    uint8_t id = read8(0x12);
    Serial.print("$"); Serial.print(i, HEX);
    Serial.print(" = 0x"); Serial.println(read8(i), HEX);
  }
  */

  uint8_t id = read8(TSL2591_COMMAND_BIT | TSL2591_REGISTER_DEVICE_ID);
  if (id == 0x50 )
  {
      //Serial.println("Found Adafruit_TSL2591");
  }
  else
  {
    return false;
  }

  _initialized = true;

  // Set default integration time and gain
  setTiming(_integration);
  setGain(_gain);

  // Note: by default, the device is in power down mode on bootup
  disable();

  return true;
}
开发者ID:annyni,项目名称:autopot-software,代码行数:34,代码来源:TSL2591.cpp


示例4: delayMicroseconds

/** Power on and prepare for general usage.
 * This will prepare the magnetometer with default settings, ready for single-
 * use mode (very low power requirements). Default settings include 8-sample
 * averaging, 15 Hz data output rate, normal measurement bias, a,d 1090 gain (in
 * terms of LSB/Gauss). Be sure to adjust any settings you need specifically
 * after initialization, especially the gain settings if you happen to be seeing
 * a lot of -4096 values (see the datasheet for mor information).
 */
void HMC5883L::initialize() {
	// We need to wait a bit...
	delayMicroseconds(HMC5883L_READY_FOR_I2C_COMMAND);

	// write CONFIG_A register
    I2Cdev::writeByte(devAddr, HMC5883L_RA_CONFIG_A,
        (HMC5883L_AVERAGING_8 << (HMC5883L_CRA_AVERAGE_BIT - HMC5883L_CRA_AVERAGE_LENGTH + 1)) |
        (HMC5883L_RATE_15     << (HMC5883L_CRA_RATE_BIT - HMC5883L_CRA_RATE_LENGTH + 1)) |
        (HMC5883L_BIAS_NORMAL << (HMC5883L_CRA_BIAS_BIT - HMC5883L_CRA_BIAS_LENGTH + 1)));

    // write CONFIG_B register
    setGain(HMC5883L_GAIN_1090);
    
    // write MODE register
    setMode(HMC5883L_MODE_SINGLE);

	// TODO: Maybe it would be a good idea to use the EEPROM
	// to store the scale factors and recover the last valid
	// value in case of a calibration fail.
	for (uint8_t gain = HMC5883L_GAIN_1370; gain <= HMC5883L_GAIN_220; gain ++) {
		scaleFactors[gain][0] = 1.0f;
		scaleFactors[gain][1] = 1.0f;
		scaleFactors[gain][2] = 1.0f;
    }

}
开发者ID:mjguisado,项目名称:i2cdevlib,代码行数:34,代码来源:HMC5883L.cpp


示例5: setGain

void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
    setGain(getGain());
    if (demodulatorPreThread) {
        std::string currentDemodType = demodulatorPreThread->getDemodType();
        if ((currentDemodType != "") && (currentDemodType != demod_type_in)) {
            lastModemSettings[currentDemodType] = demodulatorPreThread->readModemSettings();
            lastModemBandwidth[currentDemodType] = demodulatorPreThread->getBandwidth();
        }
#if ENABLE_DIGITAL_LAB
        if (activeOutput) {
            activeOutput->Hide();
        }
#endif

        demodulatorPreThread->setDemodType(demod_type_in);
        int lastbw = 0;
        if (currentDemodType != "" && lastModemBandwidth.find(demod_type_in) != lastModemBandwidth.end()) {
            lastbw = lastModemBandwidth[demod_type_in];
        }
        if (!lastbw) {
            lastbw = Modem::getModemDefaultSampleRate(demod_type_in);
        }
        if (lastbw) {
            setBandwidth(lastbw);
        }
    }
}
开发者ID:ptrauejr,项目名称:CubicSDR,代码行数:27,代码来源:DemodulatorInstance.cpp


示例6: fopen

void Stream::loadOgg(const char *filename)
{
   sound = filename;

   file = fopen(filename, "rb");
   if (!file)
      throw RubyException(rb_eRuntimeError, "Cannot open the stream file.");
   ov_open(file, &stream, NULL, 0);

   info = ov_info(&stream, -1);
   comment = ov_comment(&stream, -1);

   format = SAMPLES_FORMAT;
   
   alGenBuffers(2, buffers);
   if (alGetError() != AL_NO_ERROR)
      throw RubyException(rb_eRuntimeError, "Cannot generate the buffer.");

   generateSource();
   if (alGetError() != AL_NO_ERROR)
     throw RubyException(rb_eRuntimeError, "Cannot generate sources.");

   setPos(0.f, 0.f, 0.f);
   setVelocity(0.f, 0.f, 0.f);
   setDirection(0.f, 0.f, 0.f);

   setPitch(1.f);
   setGain(1.f);
}
开发者ID:bruni68510,项目名称:Joyau,代码行数:29,代码来源:Audio.cpp


示例7: writeReg

/*
    Calibrate which has a few weaknesses.
    1. Uses wrong gain for first reading.
    2. Uses max instead of max of average when normalizing the axis to one another.
    3. Doesn't use neg bias. (possible improvement in measurement).
*/
void HMC58X3::calibrate(unsigned char gain) {
  x_scale=1; // get actual values
  y_scale=1;
  z_scale=1;
  writeReg(HMC58X3_R_CONFA, 0x010 + HMC_POS_BIAS); // Reg A DOR=0x010 + MS1,MS0 set to pos bias
  setGain(gain);
  float x, y, z, mx=0, my=0, mz=0, t=10;
  
  for (int i=0; i<(int)t; i++) { 
    setMode(1);
    getValues(&x,&y,&z);
    if (x>mx) mx=x;
    if (y>my) my=y;
    if (z>mz) mz=z;
  }
  
  float max=0;
  if (mx>max) max=mx;
  if (my>max) max=my;
  if (mz>max) max=mz;
  x_max=mx;
  y_max=my;
  z_max=mz;
  x_scale=max/mx; // calc scales
  y_scale=max/my;
  z_scale=max/mz;

  writeReg(HMC58X3_R_CONFA, 0x010); // set RegA/DOR back to default
}   // calibrate().
开发者ID:brNX,项目名称:freeimu,代码行数:35,代码来源:HMC58X3.cpp


示例8: setTiming

/*
 Function: 
 Returns: 
 Parameters: 
 Values: 
*/
boolean WaspSensorAmbient::begin(void) 
{
  Wire.begin();

 // Initialise I2C
  Wire.beginTransmission(_addr);

  Wire.send(TSL2561_REGISTER_ID);

  Wire.endTransmission();
  Wire.requestFrom(_addr, 1);

  int x = Wire.receive();
  
  if (x & 0x0A ) 
  {} 
  else 
  {
    return false;
  }
  _initialized = true;

  // Set default integration time and gain
  setTiming(_integration);
  setGain(_gain);
  
  // Note: by default, the device is in power down mode on bootup
  disable();

  return true;
}
开发者ID:Spectos,项目名称:waspmoteapi,代码行数:37,代码来源:WaspSensorAmbient.cpp


示例9: begin

int8_t Magnetometer::begin()
{
    uint8_t buff[3];
    i2cAddr_ = HMC5833L_I2CADD;

    // Join the I2C bus as master
    WIRE.begin();

    // read the ID registers
    if (i2cReadBytes(HMC5833L_REG_IDA, buff, 3) != 0) 
        return HMC5833L_ERROR_I2CREAD;
    
    // compare the ID registers
    if (buff[0] != HMC5833L_REG_IDA_ID || buff[1] != HMC5833L_REG_IDB_ID
        || buff[2] != HMC5833L_REG_IDC_ID)
        return HMC5833L_ERROR_WRONG_ID;

    // set data rate speed to 30hz
    if (i2cWriteByte(HMC5833L_REG_CFGA, 0x14) != 0)
        return HMC5833L_ERROR_I2CWRITE;

    // set to continuous mode
    // single mode not supported by lib
    if (i2cWriteByte(HMC5833L_REG_MODE, 0) != 0)
        return HMC5833L_ERROR_I2CWRITE;

    // set default gain
    if (setGain(HMC5833L_GAIN_1090) != 0)
        return HMC5833L_ERROR_I2CWRITE;

    return 0;
}
开发者ID:MegaThomas,项目名称:Arduino-Lib.HMC5883L,代码行数:32,代码来源:HMC5883Llib.cpp


示例10: read8

boolean Adafruit_TCS34725::begin(void) 
{
  if (_juliaspinSet == 0) 
  {
      Wire.begin(I2C_SLAVE, 0x43, I2C_PINS_18_19, I2C_PULLUP_EXT, I2C_RATE_100);
  } else {
      Wire1.begin(I2C_SLAVE, 0x43, I2C_PINS_29_30, I2C_PULLUP_EXT, I2C_RATE_100);
  }
  
  /* Make sure we're actually connected */
  uint8_t x = read8(TCS34725_ID);
  if ((x != 0x44) && (x != 0x10))
  {
    return false;
  }
  _tcs34725Initialised = true;

  /* Set default integration time and gain */
  setIntegrationTime(_tcs34725IntegrationTime);
  setGain(_tcs34725Gain);

  /* Note: by default, the device is in power down mode on bootup */
  enable();

  return true;
}
开发者ID:juliahuang,项目名称:Adafruit_TCS34725,代码行数:26,代码来源:Adafruit_TCS34725.cpp


示例11: switch

void MasterSynthesizer::setState(const SynthesizerState& ss)
{
    for (const SynthesizerGroup& g : ss) {
        if (g.name() == "master") {
            for (const IdValue& v : g) {
                switch (v.id) {
                case 0:
                    setEffect(0, indexOfEffect(0, v.data));
                    break;
                case 1:
                    setEffect(1, indexOfEffect(1, v.data));
                    break;
                case 2: {
                    float f = v.data.toDouble();
                    setGain(f);
                }
                break;
                }
            }
        }
        else {
            Synthesizer* s = synthesizer(g.name());
            if (s)
                s->setState(g);
            else {
                if (effect(0) && effect(0)->name() == g.name())
                    effect(0)->setState(g);
                else if (effect(1) && effect(1)->name() == g.name())
                    effect(1)->setState(g);
            }
        }
    }

}
开发者ID:sbradl,项目名称:MuseScore,代码行数:34,代码来源:msynthesizer.cpp


示例12: biquadConfigurationImplementation

void IIRFilter::configureBiquad(int type, double frequency, double dbGain, double q) {
	double a0, a1, a2, b0, b1, b2;
	biquadConfigurationImplementation(sr, type, frequency, dbGain, q, b0, b1, b2, a0, a1, a2);
	double numerator[] = {1, b1/b0, b2/b0};
	double denominator[] = {1, a1/a0, a2/a0};
	configure(3, numerator, 3, denominator);
	setGain(b0/a0);
}
开发者ID:zaolij,项目名称:libaudioverse,代码行数:8,代码来源:iir.cpp


示例13: setInput

void AtemAudioGainCommand::readProperties(boost::property_tree::wptree& pt)
{
    AbstractCommand::readProperties(pt);

    setInput(QString::fromStdWString(pt.get(L"audiogaininput", Atem::DEFAULT_AUDIO_INPUT.toStdWString())));
    setGain(pt.get(L"gain", Atem::DEFAULT_AUDIO_GAIN));
    setTriggerOnNext(pt.get(L"triggeronnext", Atem::DEFAULT_TRIGGER_ON_NEXT));
}
开发者ID:AsgeirSH,项目名称:Client,代码行数:8,代码来源:AtemAudioGainCommand.cpp


示例14: setGain

// gain: Gain value
bool AnalogInput::setSlotGain(const Basic::Number* const msg)
{
   bool ok = false;
   if (msg != nullptr) {
      ok = setGain( msg->getReal() );
   }
   return ok;
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:9,代码来源:AnalogInput.cpp


示例15: setGain

void KRAudioSource::loadXML(tinyxml2::XMLElement *e)
{
    m_audio_sample_name = e->Attribute("sample");
    
    float gain = 1.0f;
    if(e->QueryFloatAttribute("gain", &gain)  != tinyxml2::XML_SUCCESS) {
        gain = 1.0f;
    }
    setGain(gain);
    
    float pitch = 1.0f;
    if(e->QueryFloatAttribute("pitch", &pitch) != tinyxml2::XML_SUCCESS) {
        pitch = 1.0f;
    }
    setPitch(m_pitch);
    
    bool looping = false;
    if(e->QueryBoolAttribute("looping", &looping) != tinyxml2::XML_SUCCESS) {
        looping = false;
    }
    setLooping(looping);
    
    bool is3d = true;
    if(e->QueryBoolAttribute("is3d", &is3d) != tinyxml2::XML_SUCCESS) {
        is3d = true;
    }
    setIs3D(is3d);
    
    float reference_distance = 1.0f;
    if(e->QueryFloatAttribute("reference_distance", &reference_distance) != tinyxml2::XML_SUCCESS) {
        reference_distance = 1.0f;
    }
    setReferenceDistance(reference_distance);
    
    float reverb = 0.0f;
    if(e->QueryFloatAttribute("reverb", &reverb) != tinyxml2::XML_SUCCESS) {
        reverb = 0.0f;
    }
    setReverb(reverb);
    
    float rolloff_factor = 2.0f;
    if(e->QueryFloatAttribute("rolloff_factor", &rolloff_factor) != tinyxml2::XML_SUCCESS) {
        rolloff_factor = 2.0f;
    }
    setRolloffFactor(rolloff_factor);
    
    m_enable_obstruction = true;
    if(e->QueryBoolAttribute("enable_obstruction", &m_enable_obstruction) != tinyxml2::XML_SUCCESS) {
        m_enable_obstruction = true;
    }

    m_enable_occlusion = true;
    if(e->QueryBoolAttribute("enable_occlusion", &m_enable_occlusion) != tinyxml2::XML_SUCCESS) {
        m_enable_occlusion = true;
    }
    
    KRNode::loadXML(e);
}
开发者ID:kearwood,项目名称:kraken,代码行数:58,代码来源:KRAudioSource.cpp


示例16: setGain

void TCS34725Driver::initialize() {

    setGain(gain_1);
    setIntegrationTime(time_700ms);
    setPower(true);
    // power up cycle with 2,4 ms integration time is 2,4 ms
    QThread::msleep(3);
    setAENbit(true);
}
开发者ID:skvark,项目名称:ChameleonHalf,代码行数:9,代码来源:TCS34725Driver.cpp


示例17: setMultiplexer

/** Power on and prepare for general usage.
 * This device is ready to use automatically upon power-up. It defaults to
 * single-shot read mode, P0/N1 mux, 2.048v gain, 128 samples/sec, default
 * comparator with hysterysis, active-low polarity, non-latching comparator,
 * and comparater-disabled operation. 
 */
void ADS1115::initialize() {
  setMultiplexer(ADS1115_MUX_P0_N1);
  setGain(ADS1115_PGA_2P048);
  setMode(ADS1115_MODE_SINGLESHOT);
  setRate(ADS1115_RATE_128);
  setComparatorMode(ADS1115_COMP_MODE_HYSTERESIS);
  setComparatorPolarity(ADS1115_COMP_POL_ACTIVE_LOW);
  setComparatorLatchEnabled(ADS1115_COMP_LAT_NON_LATCHING);
  setComparatorQueueMode(ADS1115_COMP_QUE_DISABLE);
}
开发者ID:01zhanglr,项目名称:i2cdevlib,代码行数:16,代码来源:ADS1115.cpp


示例18: TCS3414CS_init

void TCS3414CS_init()
{  	
	setIntegrationTime(I2C_TCS3414CS_INTEGRATION_TIME);
	setGain(I2C_TCS3414CS_GAIN|I2C_TCS3414CS_PRESCALER);
	setEnableADC();
        _delay_ms(400);
    #ifdef DEBUG_I2C
        debug_printf("I2C: i2c_tcs3414cs: init done\n");
    #endif
}
开发者ID:macmattes,项目名称:ethersex,代码行数:10,代码来源:i2c_TCS3414CS.c


示例19: setGain

	void SoundEmitter::play(float inTime, float outTime) {
		float zero = 0;
		m_origGain = m_internData.volume;
		if (!Mathf::Equal(zero, inTime)) {
			m_fadeIn = true;
			setGain(0.0f);
			play();
			m_fadeInStartTimestamp = m_internData.playTimestamp;
			m_fadeInEndTimestamp = m_fadeInStartTimestamp + static_cast<uint32_t>(inTime * 1000.0f);
		}
		if (getState() != SD_PLAYING_STATE) {
			play();
		}
		if (!Mathf::Equal(zero, outTime)) {
			m_fadeOut = true;
			setGain(0.0f);
			m_fadeOutEndTimestamp = m_internData.playTimestamp + getDuration();
			m_fadeOutStartTimestamp = m_fadeOutEndTimestamp - static_cast<uint32_t>(outTime * 1000.0f);
		}
	}
开发者ID:fifengine,项目名称:fifengine,代码行数:20,代码来源:soundemitter.cpp


示例20: setGain

/** Power on and prepare for general usage.
 * This will prepare the magnetometer with default settings, ready for single-
 * use mode (very low power requirements). Default settings include 8-sample
 * averaging, 15 Hz data output rate, normal measurement bias, a,d 1090 gain (in
 * terms of LSB/Gauss). Be sure to adjust any settings you need specifically
 * after initialization, especially the gain settings if you happen to be seeing
 * a lot of -4096 values (see the datasheet for mor information).
 */
void HMC5843::initialize() {
    // write CONFIG_A register
    I2Cdev::writeByte(devAddr, HMC5843_RA_CONFIG_A,
        (HMC5843_RATE_10     << (HMC5843_CRA_RATE_BIT - HMC5843_CRA_RATE_LENGTH + 1)) |
        (HMC5843_BIAS_NORMAL << (HMC5843_CRA_BIAS_BIT - HMC5843_CRA_BIAS_LENGTH + 1)));

    // write CONFIG_B register
    setGain(HMC5843_GAIN_1300);
    
    // write MODE register
    setMode(HMC5843_MODE_SINGLE);
}
开发者ID:0w0miki,项目名称:i2cdevlib,代码行数:20,代码来源:HMC5843.cpp



注:本文中的setGain函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setGraphicObjectProperty函数代码示例发布时间:2022-05-30
下一篇:
C++ setGLBufferData函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap