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; }
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); }
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 }
AMBasicXRFDetectorInfo& AMBasicXRFDetectorInfo::operator =(const AMBasicXRFDetectorInfo &other) { if(this != &other){ AMOldDetectorInfo::operator =(other); setElements(other.elements()); setChannels(other.channels()); setIntegrationTime(other.integrationTime()); setPeakingTime(other.peakingTime()); } return *this; }
/** Called when asyn clients call pasynFloat64->write(). * This function sends a signal to the simTask thread if the value of P_UpdateTime has changed. * For all parameters it sets the value in the parameter library and calls any registered callbacks. * \param[in] pasynUser pasynUser structure that encodes the reason and address. * \param[in] value Value to write. */ asynStatus drvQuadEM::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; int status = asynSuccess; int channel; const char *paramName; const char* functionName = "writeFloat64"; getAddress(pasynUser, &channel); /* Set the parameter in the parameter library. */ status |= setDoubleParam(channel, function, value); /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); if (function == P_AveragingTime) { status |= setAveragingTime(value); epicsRingBytesFlush(ringBuffer_); ringCount_ = 0; status |= readStatus(); } else if (function == P_BiasVoltage) { status |= setBiasVoltage(value); status |= readStatus(); } else if (function == P_IntegrationTime) { status |= setIntegrationTime(value); status |= readStatus(); } else { /* All other parameters just get set in parameter list, no need to * act on them here */ } /* Do callbacks so higher layers see any changes */ status |= (asynStatus) callParamCallbacks(); if (status) epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%f", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%f\n", driverName, functionName, function, paramName, value); return (asynStatus)status; }
/** Downloads all of the current EPICS settings to the electrometer. * Typically used after the electrometer is power-cycled. */ asynStatus drvQuadEM::reset() { epicsInt32 iValue; epicsFloat64 dValue; getIntegerParam(P_Range, &iValue); setRange(iValue); getIntegerParam(P_ValuesPerRead, &iValue); setValuesPerRead(iValue); getDoubleParam(P_AveragingTime, &dValue); setAveragingTime(dValue); getIntegerParam(P_TriggerMode, &iValue); setTriggerMode(iValue); getIntegerParam(P_NumChannels, &iValue); setNumChannels(iValue); getIntegerParam(P_BiasState, &iValue); setBiasState(iValue); getIntegerParam(P_BiasInterlock, &iValue); setBiasInterlock(iValue); getDoubleParam(P_BiasVoltage, &dValue); setBiasVoltage(dValue); getIntegerParam(P_Resolution, &iValue); setResolution(iValue); getIntegerParam(P_ReadFormat, &iValue); setReadFormat(iValue); getDoubleParam(P_IntegrationTime, &dValue); setIntegrationTime(dValue); readStatus(); getIntegerParam(P_Acquire, &iValue); setAcquire(iValue); return asynSuccess; }
boolean Adafruit_TSL2561_Unified::init() { /* Make sure we're actually connected */ uint8_t x = read8(TSL2561_REGISTER_ID); if (x & 0x05) { // ID code for TSL2561 return false; } _tsl2561Initialised = true; /* Set default integration time and gain */ setIntegrationTime(_tsl2561IntegrationTime); setGain(_tsl2561Gain); /* Note: by default, the device is in power down mode on bootup */ disable(); return true; }
Lockin2::Lockin2(QObject *parent) : QObject(parent) { // _bufferWrite = new QBuffer(&_byteArray, this); // _bufferWrite->open(QIODevice::WriteOnly | QIODevice::Unbuffered); // _bufferRead = new QBuffer(&_byteArray, this); // _bufferRead->open(QIODevice::ReadOnly | QIODevice::Unbuffered); _fifo = new QFifo(this); _fifo->open(QIODevice::ReadWrite /*| QIODevice::Unbuffered*/); _audioInput = 0; setOutputPeriod(0.5); setVumeterTime(0.0); setIntegrationTime(3.0); setPhase(0.0); }
/** Resets the electometer, rebooting the device, sleeping for 1 second, and then downloading all of the settings. */ asynStatus drvAPS_EM::reset() { int range; double integrationTime; getIntegerParam(P_Range, &range); getDoubleParam(P_IntegrationTime, &integrationTime); writeMeter(REBOOT_COMMAND, 0); epicsThreadSleep(1.0); setRange(range); epicsThreadSleep(0.01); setPulse(); epicsThreadSleep(0.01); setPeriod(); epicsThreadSleep(0.01); setIntegrationTime(integrationTime); epicsThreadSleep(0.01); setGo(); return asynSuccess; }
bool tcs34725::begin(void) { /* Make sure we're actually connected */ uint8_t x = read8(TCS34725_ID); printf("TCS34725 ID = %02x\n", x); 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; }
boolean Adafruit_TSL2561::begin(void) { Wire.begin(); /* Make sure we're actually connected */ uint8_t x = read8(TSL2561_REGISTER_ID); if (!(x & 0x0A)) { return false; } _tsl2561Initialised = true; /* Set default integration time and gain */ setIntegrationTime(_tsl2561IntegrationTime); setGain(_tsl2561Gain); /* Note: by default, the device is in power down mode on bootup */ disable(); return true; }
boolean Adafruit_TCS34725::begin(void) { _wire->begin(); /* Make sure we're actually connected */ uint8_t x = read8(TCS34725_ID); Serial.println(x, HEX); if (x != 0x44) { 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; }
boolean Light_D1::begin(tsl2561IntegrationTime_t _it, tsl2561Gain_t _gain) { uint8_t buf; Wire.begin(); /* Make sure we're actually connected */ Wire.beginTransmission(TSL2561_ADDR_LOW); if(Wire.endTransmission()){ return false; } integrationTime = _it; gain = _gain; /* Set default integration time and gain */ setIntegrationTime(integrationTime); setGain(gain); /* Note: by default, the device is in power down mode on bootup */ disable(); return true; }
bool TCS34725::begin(void) { /* Make sure we're actually connected */ uint8_t x = read8(TCS34725_ID); if (x != 0x44) { Serial.print("Error initializing sensor: "); Serial.println(x, HEX); _tcs34725Initialised = false; return false; } else { _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; } }
void CLSOceanOptics65000Detector::onSettingsControlValuesChanged() { if(isConnected()) { setIntegrationTime(integrationTimeControl()->value()); emitSettingsChanged(); } }
/** Constructor for the drvAPS_EM class. * Calls the constructor for the drvQuadEM base class. * \param[in] portName The name of the asyn port driver to be created. * \param[in] baseAddr A24 base address of the VME card * \param[in] fiberChannel Address [0-3] of the fiber channel connected to the electrometer * \param[in] unidigName Name of asynPort for the Ip-Unidig driver if it is being used to generate interrupts * \param[in] unidigChan Channel number [0-23] of the Ip-Unidig connected to the APS_EM pulse output, if Ip-Unidig is being used. * \param[in] unidigDrvInfo The drvInfo field for the data callback of the ipUnidig driver. * If not specified then asynUser->reason=0 is used. * \param[in] ringBufferSize The number of samples to hold in the input ring buffer. * This should be large enough to hold all the samples between reads of the * device, e.g. 1 ms SampleTime and 1 second read rate = 1000 samples. * If 0 then default of 2048 is used. */ drvAPS_EM::drvAPS_EM(const char *portName, unsigned short *baseAddr, int fiberChannel, const char *unidigName, int unidigChan, char *unidigDrvInfo, int ringBufferSize) : drvQuadEM(portName, 0, ringBufferSize), unidigChan_(unidigChan), pUInt32DigitalPvt_(NULL), pUInt32RegistrarPvt_(NULL) { asynInterface *pasynInterface; asynDrvUser *pdrvUser; unsigned long probeVal; epicsUInt32 mask; asynStatus status; static const char *functionName = "drvAPS_EM"; readingsAveraged_ = 0; if ((unidigName != 0) && (strlen(unidigName) != 0) && (strcmp(unidigName, "0") != 0)) { /* Create asynUser */ pUInt32DAsynUser_ = pasynManager->createAsynUser(0, 0); /* Connect to device */ status = pasynManager->connectDevice(pUInt32DAsynUser_, unidigName, unidigChan_); if (status != asynSuccess) { errlogPrintf("initQuadEM: connectDevice failed for ipUnidig\n"); goto error; } /* Get the asynUInt32DigitalCallback interface */ pasynInterface = pasynManager->findInterface(pUInt32DAsynUser_, asynUInt32DigitalType, 1); if (!pasynInterface) { errlogPrintf("%s:%s:, find asynUInt32Digital interface failed\n", driverName, functionName); goto error; } pUInt32Digital_ = (asynUInt32Digital *)pasynInterface->pinterface; pUInt32DigitalPvt_ = pasynInterface->drvPvt; /* If the drvInfo is specified then call drvUserCreate, else assume asynUser->reason=0 */ if (unidigDrvInfo) { pasynInterface = pasynManager->findInterface(pUInt32DAsynUser_, asynDrvUserType, 1); if (!pasynInterface) { errlogPrintf("%s:%s:, find asynDrvUser interface failed\n", driverName, functionName); goto error; } pdrvUser = (asynDrvUser *)pasynInterface->pinterface; status = pdrvUser->create(pasynInterface->drvPvt, pUInt32DAsynUser_, unidigDrvInfo, NULL, 0); if (status != asynSuccess) { errlogPrintf("%s:%s: drvUser->create failed for ipUnidig\n", driverName, functionName); goto error; } } else { pUInt32DAsynUser_->reason = 0; } } if ((fiberChannel >= 4) || (fiberChannel < 0)) { errlogPrintf("%s:%s:: Invalid channel # %d \n", driverName, functionName, fiberChannel); goto error; } if (baseAddr >= (unsigned short *)MAX_A24_ADDRESS) { errlogPrintf("%s:%s:: Invalid Module Address %p \n", driverName, functionName, baseAddr); goto error; } /* The channel # goes in bits 5 and 6 */ baseAddr = (unsigned short *)((int)baseAddr | ((fiberChannel << 5) & 0x60)); if (devRegisterAddress("APS_EM", atVMEA24, (int)baseAddr, 16, (volatile void**)&baseAddress_) != 0) { baseAddress_ = NULL; errlogPrintf("%s:%s: A24 Address map failed\n", driverName, functionName); goto error; } if (devReadProbe(4, (char *)baseAddress_, (char *)&probeVal) != 0 ) { errlogPrintf("%s:%s:: devReadProbe failed for address %p\n", driverName, functionName, baseAddress_); baseAddress_ = NULL; goto error; } if (pUInt32DigitalPvt_ == NULL) { if (epicsThreadCreate("APS_EMPoller", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), (EPICSTHREADFUNC)pollerThreadC, this) == NULL) { errlogPrintf("%s:%s: quadEMPoller epicsThreadCreate failure\n", driverName, functionName); goto error; } } else { /* Make sure interrupts are enabled on the falling edge of the * quadEM output pulse */ pUInt32Digital_->getInterrupt(pUInt32DigitalPvt_, pUInt32DAsynUser_, &mask, interruptOnOneToZero); mask |= 1 << unidigChan_; pUInt32Digital_->setInterrupt(pUInt32DigitalPvt_, pUInt32DAsynUser_, mask, interruptOnOneToZero); } /* Set the model */ setIntegerParam(P_Model, QE_ModelAPS_EM); /* Set the range, ping-pong and integration time to reasonable defaults */ setRange(0); setPingPong(0); setIntegrationTime(0.001); /* Send the initial settings to the board to get it talking to the * electometer. These settings will be overridden by the database values * when the database initializes */ reset(); /* Calling readStatus() will compute the sampleTime, which must be done before iocInit * or fast feedback won't work. */ readStatus(); error: return; }