const char* CPairedRead::GetMappedContig() const { int tMapped = GetMappedValue(); switch ( tMapped ) { case 1: if ( m_sameChr == 1 || GetPos( 0 ) < GetPos( 1 ) ) { return m_contig[0].c_str(); } else { return m_contig[1].c_str(); } break; case 2: case 3: case 4: return "invert"; case 5: return "interchromo"; case 6: return "single"; case 7: return "unmap"; default: std::cerr << "Can not parse mapping position!!" << std::endl; exit( -1 ); } }
static int writeADC(SampleRecord *sampleRecord, size_t currentTicks, LoggerConfig *config){ int rate = SAMPLE_DISABLED; unsigned int adc[CONFIG_ADC_CHANNELS]; int adcRead = 0; for (unsigned int i=0; i < CONFIG_ADC_CHANNELS;i++){ ADCConfig *ac = &(config->ADCConfigs[i]); size_t sr = ac->cfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr,rate); if (!adcRead){ readAllADC(&adc[0],&adc[1],&adc[2],&adc[3],&adc[4],&adc[5],&adc[6],&adc[7]); adcRead = 1; } float analogValue = 0; switch(ac->scalingMode){ case SCALING_MODE_RAW: analogValue = adc[i]; break; case SCALING_MODE_LINEAR: analogValue = (ac->linearScaling * (float)adc[i]); break; case SCALING_MODE_MAP: analogValue = GetMappedValue((float)adc[i],&(ac->scalingMap)); break; } if (ac->loggingPrecision == 0){ sampleRecord->ADCSamples[i].intValue = analogValue; }else{ sampleRecord->ADCSamples[i].floatValue = analogValue; } } } } return rate; }