public class McpAdc extends AbstractDeviceFactory implements AnalogInputDeviceFactoryInterface, Closeable
Modifier and Type | Class and Description |
---|---|
static class |
McpAdc.Type
The MCP3204/3208 devices offer the choice of using the analog input channels configured
as single-ended inputs or pseudo-differential pairs.
|
Modifier and Type | Field and Description |
---|---|
static McpAdc.Type |
MCP3001 |
static McpAdc.Type |
MCP3002 |
static McpAdc.Type |
MCP3004 |
static McpAdc.Type |
MCP3008 |
static McpAdc.Type |
MCP3201 |
static McpAdc.Type |
MCP3202 |
static McpAdc.Type |
MCP3204 |
static McpAdc.Type |
MCP3208 |
static McpAdc.Type |
MCP3301 |
static McpAdc.Type |
MCP3302 |
static McpAdc.Type |
MCP3304 |
deviceStates
Constructor and Description |
---|
McpAdc(McpAdc.Type type,
int chipSelect) |
McpAdc(McpAdc.Type type,
int controller,
int chipSelect) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
String |
getName() |
float |
getValue(int adcPin)
Read the analog value in the range 0..1 or -1..1 (if the ADC type is signed)
|
GpioAnalogInputDeviceInterface |
provisionAnalogInputPin(int pinNumber)
Device Factory SPI method
|
closeAll, deviceClosed, deviceOpened, getDevice, isDeviceOpened
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
closeAll, deviceClosed, deviceOpened, isDeviceOpened
public static final McpAdc.Type MCP3001
public static final McpAdc.Type MCP3002
public static final McpAdc.Type MCP3004
public static final McpAdc.Type MCP3008
public static final McpAdc.Type MCP3201
public static final McpAdc.Type MCP3202
public static final McpAdc.Type MCP3204
public static final McpAdc.Type MCP3208
public static final McpAdc.Type MCP3301
public static final McpAdc.Type MCP3302
public static final McpAdc.Type MCP3304
public McpAdc(McpAdc.Type type, int chipSelect) throws RuntimeIOException
RuntimeIOException
public McpAdc(McpAdc.Type type, int controller, int chipSelect) throws RuntimeIOException
RuntimeIOException
public void close() throws RuntimeIOException
close
in interface Closeable
close
in interface AutoCloseable
RuntimeIOException
public float getValue(int adcPin) throws RuntimeIOException
adcPin
- Pin on the MCP deviceRuntimeIOException
- if an I/O error occurspublic GpioAnalogInputDeviceInterface provisionAnalogInputPin(int pinNumber) throws RuntimeIOException
provisionAnalogInputPin
in interface AnalogInputDeviceFactoryInterface
pinNumber
- Pin on the MCP deviceRuntimeIOException
public String getName()
getName
in interface DeviceFactoryInterface
Copyright © 2016 mattjlewis. All rights reserved.