Package com.diozero.devices
Class Ads112C04
java.lang.Object
com.diozero.internal.spi.AbstractDeviceFactory
com.diozero.devices.Ads112C04
- All Implemented Interfaces:
DeviceInterface
,AnalogInputDeviceFactoryInterface
,DeviceFactoryInterface
,AutoCloseable
public class Ads112C04 extends AbstractDeviceFactory implements AnalogInputDeviceFactoryInterface, DeviceInterface
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Ads112C04.AdcEvent
static class
Ads112C04.Address
The ADS112C04 has two address pins: A0 and A1.static class
Ads112C04.Builder
static class
Ads112C04.BurnoutCurrentSources
static class
Ads112C04.ConfigRegister
static class
Ads112C04.ConversionMode
static class
Ads112C04.CrcConfig
static class
Ads112C04.DataCounter
static class
Ads112C04.DataRate
static class
Ads112C04.GainConfig
static class
Ads112C04.Idac1RoutingConfig
static class
Ads112C04.Idac2RoutingConfig
static class
Ads112C04.IdacCurrent
static class
Ads112C04.InputMultiplexerConfig
Input multiplexer configurationstatic class
Ads112C04.OperatingMode
static class
Ads112C04.Pga
static class
Ads112C04.TemperatureSensorMode
static class
Ads112C04.VRef
-
Field Summary
Fields inherited from class com.diozero.internal.spi.AbstractDeviceFactory
closed, deviceStates
-
Constructor Summary
Constructors Modifier Constructor Description protected
Ads112C04(int controller, Ads112C04.Address address, Ads112C04.GainConfig gainConfig, Ads112C04.Pga pga, Ads112C04.DataRate dataRate, Ads112C04.OperatingMode operatingMode, Ads112C04.VRef vRef, Ads112C04.TemperatureSensorMode tsMode, Ads112C04.DataCounter dataCounter, Ads112C04.CrcConfig crcConfig, Ads112C04.BurnoutCurrentSources burnoutCurrentSources, Ads112C04.IdacCurrent idacCurrent, Ads112C04.Idac1RoutingConfig idac1RoutingConfig, Ads112C04.Idac2RoutingConfig idac2RoutingConfig, Ads112C04.InputMultiplexerConfig inputMultiplexerConfig)
-
Method Summary
Methods inherited from class com.diozero.internal.spi.AbstractDeviceFactory
createI2CKey, createPinKey, createSerialKey, createSpiKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened, reopen
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.diozero.internal.spi.AnalogInputDeviceFactoryInterface
provisionAnalogInputDevice
Methods inherited from interface com.diozero.internal.spi.DeviceFactoryInterface
createI2CKey, createPinKey, createSerialKey, createSpiKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened, reopen, start
-
Constructor Details
-
Ads112C04
protected Ads112C04(int controller, Ads112C04.Address address, Ads112C04.GainConfig gainConfig, Ads112C04.Pga pga, Ads112C04.DataRate dataRate, Ads112C04.OperatingMode operatingMode, Ads112C04.VRef vRef, Ads112C04.TemperatureSensorMode tsMode, Ads112C04.DataCounter dataCounter, Ads112C04.CrcConfig crcConfig, Ads112C04.BurnoutCurrentSources burnoutCurrentSources, Ads112C04.IdacCurrent idacCurrent, Ads112C04.Idac1RoutingConfig idac1RoutingConfig, Ads112C04.Idac2RoutingConfig idac2RoutingConfig, Ads112C04.InputMultiplexerConfig inputMultiplexerConfig)
-
-
Method Details
-
builder
-
sendResetCommand
public void sendResetCommand() -
sendStartCommand
public void sendStartCommand() -
powerDown
public void powerDown() -
readConfigRegister
-
getInputMultiplexerConfig
-
getGainConfig
-
setGainConfig
-
getPga
-
setPga
-
getDataRate
-
setDataRate
-
isTurboModeEnabled
public boolean isTurboModeEnabled() -
setTurboModeEnabled
public void setTurboModeEnabled(boolean enabled) -
getDataRateFrequency
public int getDataRateFrequency() -
getVRefConfig
-
setVRefConfig
-
isTemperatureSensorModeEnabled
public boolean isTemperatureSensorModeEnabled() -
setTemperatureSensorModeEnabled
public void setTemperatureSensorModeEnabled(boolean enabled) -
isDataCounterEnabled
public boolean isDataCounterEnabled() -
setDataCounterEnabled
public void setDataCounterEnabled(boolean enabled) -
getCrcConfig
-
setCrcConfig
-
getBurnoutCurrentSources
-
setBurnoutCurrentSources
-
getIdacCurrent
-
setIdacCurrent
-
getIdac1RoutingConfig
-
setIdac1RoutingConfig
-
getIdac2RoutingConfig
-
setIdac2RoutingConfig
-
setConfig0
public void setConfig0(Ads112C04.InputMultiplexerConfig inputMultiplexerConfig, Ads112C04.GainConfig gainConfig, Ads112C04.Pga pga) -
setConfig1
public void setConfig1(Ads112C04.DataRate dataRate, boolean turboModeEnabled, Ads112C04.VRef vRef, boolean temperatureSensorEnabled) -
setConfig2
public void setConfig2(boolean dataCounterEnabled, Ads112C04.CrcConfig crcConfig, Ads112C04.BurnoutCurrentSources burnoutCurrentSources, Ads112C04.IdacCurrent idacCurrent) -
setConfig3
public void setConfig3(Ads112C04.Idac1RoutingConfig idac1RoutingConfig, Ads112C04.Idac2RoutingConfig idac2RoutingConfig) -
setSingleShotMode
public void setSingleShotMode() -
getSingleShotReadingNonDifferential
public short getSingleShotReadingNonDifferential(int adcNumber)Disable continuous readings and take a single-shot reading on the specified ADC number (non-differential reads).- Parameters:
adcNumber
- The ADC number to read from- Returns:
- The current raw Analog reading
-
getSingleShotReading
Disable continuous readings and take a single-shot reading on the specified ADC number. For settings where AINN = AVSS, the PGA must be disabled (PGA_BYPASS = 1) and only gains 1, 2, and 4 can be used.- Parameters:
inputMultiplexerConfig
- the input multiplexer configuration- Returns:
- The current raw Analog reading
-
setContinuousModeNonDifferential
public void setContinuousModeNonDifferential(int adcNumber)Enable continuous read mode for the specified ADC number (AINp = AIN{adcNumber}, AINn = AVSS). Note the PGA must be disabled and only gains 1, 2, and 4 can be used.- Parameters:
adcNumber
- The ADC to continuously read from (non-differential mode)
-
setContinuousMode
Enable continuous read mode for the specified input multiplexer value. For settings where AINN = AVSS, the PGA must be disabled and only gains 1, 2, and 4 can be used.- Parameters:
inputMultiplexerConfig
- The input multiplexer configuration
-
setContinuousModeNonDifferential
public Object setContinuousModeNonDifferential(int adcNumber, DigitalInputDevice intr, Consumer<Ads112C04.AdcEvent> listener) -
getReadingOnDataReadyBit
public short getReadingOnDataReadyBit()Read data whenever the data read bit is set in Config Register #2- Returns:
- the raw analog data reading in signed short format
-
readData
public short readData(int bytes_to_read) -
getReadingOnDataReadyBit2
public short getReadingOnDataReadyBit2()Read data whenever the data read bit is set in Config Register #2- Returns:
- the raw analog data reading in signed short format
-
getReadingOnDataCounterChange
public short getReadingOnDataCounterChange() -
getName
Description copied from interface:DeviceFactoryInterface
Get the name of this device factory- Specified by:
getName
in interfaceDeviceFactoryInterface
- Returns:
- the name of this device factory
-
getBoardPinInfo
Description copied from interface:DeviceFactoryInterface
Get information about pins that can be provisioned by this device factory.- Specified by:
getBoardPinInfo
in interfaceDeviceFactoryInterface
- Returns:
-
createAnalogInputDevice
- Specified by:
createAnalogInputDevice
in interfaceAnalogInputDeviceFactoryInterface
-
getVRef
public float getVRef()- Specified by:
getVRef
in interfaceAnalogInputDeviceFactoryInterface
-
close
public void close()Description copied from interface:DeviceFactoryInterface
Close this device factory including all devices that have been provisioned by it.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDeviceFactoryInterface
- Specified by:
close
in interfaceDeviceInterface
- Overrides:
close
in classAbstractDeviceFactory
-