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 Detail
-
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 Detail
-
builder
public static Ads112C04.Builder builder(Ads112C04.Address address)
-
sendResetCommand
public void sendResetCommand()
-
sendStartCommand
public void sendStartCommand()
-
powerDown
public void powerDown()
-
readConfigRegister
public byte readConfigRegister(Ads112C04.ConfigRegister register)
-
getInputMultiplexerConfig
public Ads112C04.InputMultiplexerConfig getInputMultiplexerConfig()
-
getGainConfig
public Ads112C04.GainConfig getGainConfig()
-
setGainConfig
public void setGainConfig(Ads112C04.GainConfig gainConfig)
-
getPga
public Ads112C04.Pga getPga()
-
setPga
public void setPga(Ads112C04.Pga pga)
-
getDataRate
public Ads112C04.DataRate getDataRate()
-
setDataRate
public void setDataRate(Ads112C04.DataRate dataRate)
-
isTurboModeEnabled
public boolean isTurboModeEnabled()
-
setTurboModeEnabled
public void setTurboModeEnabled(boolean enabled)
-
getDataRateFrequency
public int getDataRateFrequency()
-
getVRefConfig
public Ads112C04.VRef getVRefConfig()
-
setVRefConfig
public void setVRefConfig(Ads112C04.VRef vRef)
-
isTemperatureSensorModeEnabled
public boolean isTemperatureSensorModeEnabled()
-
setTemperatureSensorModeEnabled
public void setTemperatureSensorModeEnabled(boolean enabled)
-
isDataCounterEnabled
public boolean isDataCounterEnabled()
-
setDataCounterEnabled
public void setDataCounterEnabled(boolean enabled)
-
getCrcConfig
public Ads112C04.CrcConfig getCrcConfig()
-
setCrcConfig
public void setCrcConfig(Ads112C04.CrcConfig crcConfig)
-
getBurnoutCurrentSources
public Ads112C04.BurnoutCurrentSources getBurnoutCurrentSources()
-
setBurnoutCurrentSources
public void setBurnoutCurrentSources(Ads112C04.BurnoutCurrentSources burnoutCurrentSources)
-
getIdacCurrent
public Ads112C04.IdacCurrent getIdacCurrent()
-
setIdacCurrent
public void setIdacCurrent(Ads112C04.IdacCurrent idacCurrent)
-
getIdac1RoutingConfig
public Ads112C04.Idac1RoutingConfig getIdac1RoutingConfig()
-
setIdac1RoutingConfig
public void setIdac1RoutingConfig(Ads112C04.Idac1RoutingConfig idac1RoutingConfig)
-
getIdac2RoutingConfig
public Ads112C04.Idac2RoutingConfig getIdac2RoutingConfig()
-
setIdac2RoutingConfig
public void setIdac2RoutingConfig(Ads112C04.Idac2RoutingConfig idac2RoutingConfig)
-
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
public short getSingleShotReading(Ads112C04.InputMultiplexerConfig inputMultiplexerConfig)
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
public void setContinuousMode(Ads112C04.InputMultiplexerConfig inputMultiplexerConfig)
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
public String 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
public BoardPinInfo getBoardPinInfo()
Description copied from interface:DeviceFactoryInterface
Get information about pins that can be provisioned by this device factory.- Specified by:
getBoardPinInfo
in interfaceDeviceFactoryInterface
- Returns:
- board pin info instance for this device factory
-
createAnalogInputDevice
public AnalogInputDeviceInterface createAnalogInputDevice(String key, PinInfo pinInfo)
- 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
-
-