当前位置: 首页>>代码示例>>C++>>正文


C++ calibrate函数代码示例

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


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

示例1: calibrate

/* Set the voltage reference you prefer, default is vcc
*   It needs to recalibrate
*/
void ADC::setReference(uint8_t type)
{
	if (type) {
		// internal reference requested
		if (!analog_reference_internal) {
			analog_reference_internal = 1;
			if (calibrating) ADC0_SC3 = 0; // cancel cal
			calibrate();
		}
	} else {
		// vcc or external reference requested
		if (analog_reference_internal) {
			analog_reference_internal = 0;
			if (calibrating) ADC0_SC3 = 0; // cancel cal
			calibrate();
		}
	}
}
开发者ID:jimparis,项目名称:ADC,代码行数:21,代码来源:ADC.cpp

示例2: main

int main(int argc, char **argv)
{

	suseconds_t s = 100000;
	unit = calibrate(s);

	master();
	return EXIT_SUCCESS;
}
开发者ID:pgmplus,项目名称:workload-kit,代码行数:9,代码来源:cpm2.c

示例3: p7_Builder

/* Function:  p7_Builder()
 * Synopsis:  Build a new HMM from an MSA.
 *
 * Purpose:   Take the multiple sequence alignment <msa> and a build configuration <bld>,
 *            and build a new HMM. 
 * 
 *            Effective sequence number determination and calibration steps require
 *            additionally providing a null model <bg>.
 *
 * Args:      bld         - build configuration
 *            msa         - multiple sequence alignment
 *            bg          - null model
 *            opt_hmm     - optRETURN: new HMM
 *            opt_trarr   - optRETURN: array of faux tracebacks, <0..nseq-1>
 *            opt_gm      - optRETURN: profile corresponding to <hmm>
 *            opt_om      - optRETURN: optimized profile corresponding to <gm>
 *            opt_postmsa - optRETURN: RF-annotated, possibly modified MSA 
 *
 * Returns:   <eslOK> on success. The new HMM is optionally returned in
 *            <*opt_hmm>, along with optional returns of an array of faux tracebacks
 *            for each sequence in <*opt_trarr>, the annotated MSA used to construct
 *            the model in <*opt_postmsa>, a configured search profile in 
 *            <*opt_gm>, and an optimized search profile in <*opt_om>. These are
 *            all optional returns because the caller may, for example, be interested
 *            only in an optimized profile, or may only be interested in the HMM.
 *            
 *            Returns <eslENORESULT> if no consensus columns were annotated.
 *            Returns <eslEFORMAT> on MSA format problems, such as a missing RF annotation
 *            line in hand architecture construction. On any returned error,
 *            <bld->errbuf> contains an informative error message.
 *
 * Throws:    <eslEMEM> on allocation error.
 *            <eslEINVAL> if relative weights couldn't be calculated from <msa>.
 *
 * Xref:      J4/30.
 */
int
p7_Builder(P7_BUILDER *bld, ESL_MSA *msa, P7_BG *bg,
	   P7_HMM **opt_hmm, P7_TRACE ***opt_trarr, P7_PROFILE **opt_gm, P7_OPROFILE **opt_om,
	   ESL_MSA **opt_postmsa)
{
  int i,j;
  uint32_t    checksum = 0;	/* checksum calculated for the input MSA. hmmalign --mapali verifies against this. */
  P7_HMM     *hmm      = NULL;
  P7_TRACE  **tr       = NULL;
  P7_TRACE ***tr_ptr   = (opt_trarr != NULL || opt_postmsa != NULL) ? &tr : NULL;
  int         status;
  if ((status =  validate_msa         (bld, msa))                       != eslOK) goto ERROR;
  if ((status =  esl_msa_Checksum     (msa, &checksum))                 != eslOK) ESL_XFAIL(status, bld->errbuf, "Failed to calculate checksum"); 
  if ((status =  relative_weights     (bld, msa))                       != eslOK) goto ERROR;
  if ((status =  esl_msa_MarkFragments(msa, bld->fragthresh))           != eslOK) goto ERROR;
  if ((status =  build_model          (bld, msa, &hmm, tr_ptr))         != eslOK) goto ERROR;

  //Ensures that the weighted-average I->I count <=  bld->max_insert_len
  //(MI currently contains the number of observed insert-starts)
  if (bld->max_insert_len>0)
    for (i=1; i<hmm->M; i++ )
      hmm->t[i][p7H_II] = ESL_MIN(hmm->t[i][p7H_II], bld->max_insert_len*hmm->t[i][p7H_MI]);

  if ((status =  effective_seqnumber  (bld, msa, hmm, bg))              != eslOK) goto ERROR;
  if ((status =  parameterize         (bld, hmm))                       != eslOK) goto ERROR;
  if ((status =  annotate             (bld, msa, hmm))                  != eslOK) goto ERROR;
  if ((status =  calibrate            (bld, hmm, bg, opt_gm, opt_om))   != eslOK) goto ERROR;
  if ((status =  make_post_msa        (bld, msa, hmm, tr, opt_postmsa)) != eslOK) goto ERROR;

  //force masked positions to background  (it'll be close already, so no relevant impact on weighting)
  if (hmm->mm != NULL)
    for (i=1; i<hmm->M; i++ )
      if (hmm->mm[i] == 'm')
        for (j=0; j<hmm->abc->K; j++)
          hmm->mat[i][j] = bg->f[j];

  if ( bld->abc->type == eslDNA ||  bld->abc->type == eslRNA ) {
	  if (bld->w_len > 0)           hmm->max_length = bld->w_len;
	  else if (bld->w_beta == 0.0)  hmm->max_length = hmm->M *4;
	  else if ( (status =  p7_Builder_MaxLength(hmm, bld->w_beta)) != eslOK) goto ERROR;
  }

  hmm->checksum = checksum;
  hmm->flags   |= p7H_CHKSUM;

  if (opt_hmm   != NULL) *opt_hmm   = hmm; else p7_hmm_Destroy(hmm);
  if (opt_trarr != NULL) *opt_trarr = tr;  else p7_trace_DestroyArray(tr, msa->nseq);
  return eslOK;

 ERROR:
  p7_hmm_Destroy(hmm);
  p7_trace_DestroyArray(tr, msa->nseq);
  if (opt_gm    != NULL) p7_profile_Destroy(*opt_gm);
  if (opt_om    != NULL) p7_oprofile_Destroy(*opt_om);
  return status;
}
开发者ID:dboudour2002,项目名称:musicHMMER,代码行数:92,代码来源:p7_builder.c

示例4: calibrateRoutine

/*--------------------------------------------*/
void Calibrate_Class::calibrateRoutine()
{
  if (millis() > utils->lastWrite_offboard + utils->offboardWriteInc)
  {
    utils->multiplexInCVs();
    if(calibrating == true) calibrate();
    writeCalibrate_lcd();
    utils->lastWrite_offboard = millis();
  }
}
开发者ID:stevenlitt,项目名称:fu2_baby,代码行数:11,代码来源:Calibrate_Class.cpp

示例5: loop

void loop() {
  //  int sensorValue = 0;
  //  sensorValue =  analogRead(A0);
  //  double ampl = abs(mean-sensorValue);
  //  if(ampl>meanAmpl){
  //    Serial.println("Calla puta!");
  //  }
  calibrate();
  delay(1000);
}
开发者ID:paternoy,项目名称:Arduino,代码行数:10,代码来源:main.cpp

示例6: sniffer_start

/* 
 * -- sniffer_start
 * 
 * In order to start the Syskonnect sk98 we open the device and 
 * mmap a region in memory that the driver has allocated for us
 * (it will keep the tokens for the packets). 
 * Then, we inform the driver of the size of the packet buffer and
 * where it is. Finally, start timer calibration using the sk98-timers API. 
 * It returns 0 on success, -1 on failure.
 * 
 */
static int
sniffer_start(source_t * src) 
{
    struct _snifferinfo * info; 
    struct sk98_ioctl_map args;
    int fd;

    /* Start up the timestamps library 
     * 
     * XXX where do we get 78110207 from? (initial frequency?) 
     */
    initialise_timestamps(1, 78110207, NULL);

    /* open the device */
    fd = open(src->device, O_RDWR);
    if (fd < 0) {
        logmsg(LOGWARN, "sniffer-sk98: cannot open %s: %s\n", 
	    src->device, strerror(errno)); 
        return -1;
    } 

    src->ptr = safe_malloc(sizeof(struct _snifferinfo)); 
    info = (struct _snifferinfo *) src->ptr; 

    /* 
     * mmap the region that contains the ring buffers 
     * with the tokens. 
     */ 
    info->m = mmap(NULL, sizeof(struct map_area_header), 
			PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
    if (info->m == MAP_FAILED) {
        logmsg(LOGWARN, "sniffer-sk98: failed to mmap %s: %s\n", 
	    src->device, strerror(errno)); 
	free(src->ptr);
        return -1;
    } 

    /* inform the driver of where the packets should go */
    args.len = 1024 * 1024 * BUFFER_MB;
    args.offset = 0;
    info->packet_pool = safe_malloc(args.len);
    args.start_addr = info->packet_pool;
    if (ioctl(fd, SK98_IOCTL_MAP, &args) < 0) {
        logmsg(LOGWARN, "sniffer-sk98: failed creating packet pool: %s\n", 
	    strerror(errno)); 
	free(src->ptr);
        return -1;
    } 

    /* do timer calibration */
    calibrate(info); 

    src->fd = fd; 
    return 0;	/* success */
}
开发者ID:JackieXie168,项目名称:como,代码行数:66,代码来源:sniffer-sk98.c

示例7: Vector

void Perspective::calibrate(Coord ca, Coord cb, Coord cc, Coord cd)
{
	Vector* a = new Vector(ca);
	Vector* b = new Vector(cb);
	Vector* c = new Vector(cc);
	Vector* d = new Vector(cd);

	calibrate(a, b, c, d);

	delete a, b, c, d;
}
开发者ID:Askir,项目名称:Wiiteboard-Rework,代码行数:11,代码来源:Perspective.cpp

示例8: calibrate

float LIS3MDL_TWI::readAzimut() {
    calibrate();
    float heading = atan2(_yCalibrate, _xCalibrate);

    if(heading < 0)
        heading += TWO_PI;
    else if(heading > TWO_PI)
        heading -= TWO_PI;
    float headingDegrees = heading * RAD_TO_DEG;
    return headingDegrees;
}
开发者ID:amperka,项目名称:Troyka-IMU,代码行数:11,代码来源:lis3mdl.cpp

示例9: calibrate

void CNCArduinostepsClass::calculatecurcorunits(currencoord inputcurcor, currencoordunits &outputcurcorunits)
{
	if (calibset)
	{
		//outputcurcorunits.currentXunits = inputcurcor.currentXs*calibrationX;
		//outputcurcorunits.currentYunits = inputcurcor.currentYs*calibrationY;
		outputcurcorunits.currentXunits = inputcurcor.currentXs/stepspermmX;
		outputcurcorunits.currentYunits = inputcurcor.currentYs/stepspermmY;
	}
	else { calibrate(2,false); }
}
开发者ID:adigyran,项目名称:arduinodefectoscopemathlab,代码行数:11,代码来源:CNCArduinosteps.cpp

示例10: read_def_file

LinuxJoystick::LinuxJoystick(int which, int doCalibrate)
{
  joy = which;
  fd = -1;
  has_z = has_r = 0;
  naxis = 2;
  read_def_file(joy ? joydef1 : joydef0 );
  if (doCalibrate)
    calibrate();
  active = open();
}
开发者ID:zear,项目名称:sabre,代码行数:11,代码来源:linux_joy.C

示例11: main

task main() {
	tSensors ports[3] = {in1, in2, in3};
	newGyroArray(&gyroArray, ports, 3);  // Set up gyroArray in analog ports 1, 2, and 3.
	calibrate(&gyroArray);  // Calibrate gyroArray.

	newGyro(&gyro1, in1);
	calibrate(&gyro1);
	newGyro(&gyro2, in2);
	calibrate(&gyro2);
	newGyro(&gyro3, in3);
	calibrate(&gyro3);

	startTask(background);  // Update gyro angle in the background.

	// Turn left 90 degrees.
	while (getDifferenceInAngleDegrees(getAngle(&gyroArray), 90.0) > 0.0) {
		motor[port2] = 127;
		motor[port3] = -127;
	}
	motor[port2] = motor[port3] = 0;
}
开发者ID:jtkiesel,项目名称:bnsLib,代码行数:21,代码来源:gyroArrayTest.c

示例12: calibrate

void DAQCalibration::execute(void)
{
	if(data_idx < 1/period)
	{
		channel_data.push_back(input(0));
		data_idx++;

		if(data_idx == 1/period)
			calibrate();
	}
	return;
}
开发者ID:RTXI,项目名称:daq_calibration,代码行数:12,代码来源:daq_calibration.cpp

示例13: ofLog

	bool Calibration::calibrateFromDirectory(string directory) {
		ofDirectory dirList;
		ofImage cur;
		dirList.listDir(directory);
		for(int i = 0; i < (int)dirList.size(); i++) {
			cur.loadImage(dirList.getPath(i));
			if(!add(toCv(cur))) {
				ofLog(OF_LOG_ERROR, "Calibration::add() failed on " + dirList.getPath(i));
			}
		}
		return calibrate();
	}
开发者ID:Chris-2u,项目名称:SurfacePhone-Framework,代码行数:12,代码来源:Calibration.cpp

示例14: main

void main(void)
{
    // Initialise system
    setup();
    // used for debugging.
    TRISBbits.RB4 = 0;
    PORTBbits.RB4 = 0;

    // Loop until the system is turned off
    while (req_state & POWER_ON)
    {
        int serial_data;
        switch (cur_state)
        {
            case ST_WEIGH: weigh(); break;
            case ST_COUNT_I:
            case ST_COUNT_F: count(); break;
            case ST_CALIBRATE: calibrate(); break;
        }
        serial_data = parseSerial();

        if (serial_data != RS232_NO_DATA)
        {
            RS232writeByte(COMM_DEBUG);
            RS232writeByte(cur_state);
            RS232writeByte(disp_type);
            //RS232writeByte(serial_data);
        }

        if (req_state != ST_NONE)
        {
//            int timeout = 0xFFFF;
//            int serial_return;
            cur_state = req_state;
            // Send Change to GUI.
            if (!st_chng_rs232_flag)
            {
                if (cur_state == ST_COUNT_F)
                {
                    RS232sendData_b_i(COMM_CHANGE_STATE, cur_state, number_items);
                }
                else
                {
                    RS232sendData_b(COMM_CHANGE_STATE, cur_state);
                }
            }
            st_chng_rs232_flag = 0;
            req_state = ST_NONE;
        }
    }

    powerDown();            // Save state and power down.
}
开发者ID:swardrop,项目名称:FennecProject,代码行数:53,代码来源:fennecscales.c

示例15: main

int main(int argc, char** argv)
{
  ros::init(argc, argv, "calibrate");

  CalibrateAction calibrate(ros::this_node::getName());

  ROS_INFO("Calibration Server started");

  ros::spin();

  return 0;
}
开发者ID:GKIFreiburg,项目名称:gki_navigation_apps,代码行数:12,代码来源:calibrate_twist_server.cpp


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